diff options
Diffstat (limited to 'src')
316 files changed, 10485 insertions, 8818 deletions
diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp index 403be6e..72bdef7 100644 --- a/src/CBot/CBot.cpp +++ b/src/CBot/CBot.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////////////////////////// // compilation of various instructions diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h index df6614e..3355881 100644 --- a/src/CBot/CBot.h +++ b/src/CBot/CBot.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ //////////////////////////////////////////////////////////////////// /** * \file CBot.h diff --git a/src/CBot/CBotAddExpr.cpp b/src/CBot/CBotAddExpr.cpp index ec007ae..03317f8 100644 --- a/src/CBot/CBotAddExpr.cpp +++ b/src/CBot/CBotAddExpr.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////// // expressions of type Operand1 + Operand2 diff --git a/src/CBot/CBotClass.cpp b/src/CBot/CBotClass.cpp index 12765ba..5369b77 100644 --- a/src/CBot/CBotClass.cpp +++ b/src/CBot/CBotClass.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/.// +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ ///////////////////////////////////////////////////////////////////// // Management of variables of class type diff --git a/src/CBot/CBotCompExpr.cpp b/src/CBot/CBotCompExpr.cpp index c9a977c..6217638 100644 --- a/src/CBot/CBotCompExpr.cpp +++ b/src/CBot/CBotCompExpr.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////// // expression of type Opérande1 > Opérande2 diff --git a/src/CBot/CBotDll.h b/src/CBot/CBotDll.h index 8858559..8ae0a14 100644 --- a/src/CBot/CBotDll.h +++ b/src/CBot/CBotDll.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ //////////////////////////////////////////////////////////////////////// /** diff --git a/src/CBot/CBotFunction.cpp b/src/CBot/CBotFunction.cpp index e6aa2c9..9c8a2ce 100644 --- a/src/CBot/CBotFunction.cpp +++ b/src/CBot/CBotFunction.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////////////////////////// // compilation of various functions declared by the user diff --git a/src/CBot/CBotIf.cpp b/src/CBot/CBotIf.cpp index bc58af1..2bd6448 100644 --- a/src/CBot/CBotIf.cpp +++ b/src/CBot/CBotIf.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////////////////////////// // instruction if (condition) operation1 else operation2; diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp index 1944f92..d3c5eb3 100644 --- a/src/CBot/CBotProgram.cpp +++ b/src/CBot/CBotProgram.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ ////////////////////////////////////////////////////////////////////// // database management of CBoT program diff --git a/src/CBot/CBotStack.cpp b/src/CBot/CBotStack.cpp index 1679e5e..42d5617 100644 --- a/src/CBot/CBotStack.cpp +++ b/src/CBot/CBotStack.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ //Management of the stack @@ -788,7 +791,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end) while (p->m_next != NULL) { if ( p->m_instr != NULL ) instr = p->m_instr; - if ( p->m_bFunc == 1 ) funct = p->m_instr; + if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr; if ( p->m_next->m_prog != prog ) break ; if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ; @@ -796,7 +799,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end) } if ( p->m_instr != NULL ) instr = p->m_instr; - if ( p->m_bFunc == 1 ) funct = p->m_instr; + if ( p->m_bFunc == 1 && p->m_instr != NULL ) funct = p->m_instr; if ( funct == NULL ) return; @@ -807,7 +810,7 @@ void CBotStack::GetRunPos(const char* &FunctionName, int &start, int &end) t = instr->GetToken(); start = t->GetStart(); - end = t->GetEnd(); + end = t->GetEnd(); } CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level) @@ -825,16 +828,19 @@ CBotVar* CBotStack::GetStackVars(const char* &FunctionName, int level) if (p->m_next2 && p->m_next2->m_state != 0) p = p->m_next2 ; else p = p->m_next; } + // Now p is the highest element on the stack // descends upon the elements of block while ( p != NULL && !p->m_bBlock ) p = p->m_prev; + // Now p is on the beggining of the top block (with local variables) while ( p != NULL && level++ < 0 ) { p = p->m_prev; while ( p != NULL && !p->m_bBlock ) p = p->m_prev; } + // Now p is on the block "level" if ( p == NULL ) return NULL; diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp index 2929977..ef3950a 100644 --- a/src/CBot/CBotString.cpp +++ b/src/CBot/CBotString.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ ///////////////////////////////////////////////////// //strings management diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp index 48033a3..40c020a 100644 --- a/src/CBot/CBotToken.cpp +++ b/src/CBot/CBotToken.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ ////////////////////////////////////////////////////////////////// @@ -105,7 +108,7 @@ void CBotToken::Free() const CBotToken& CBotToken::operator=(const CBotToken& src) { - if (m_next != NULL) delete(m_next); + delete m_next; m_next = NULL; m_prev = NULL; diff --git a/src/CBot/CBotToken.h b/src/CBot/CBotToken.h index a423375..d789734 100644 --- a/src/CBot/CBotToken.h +++ b/src/CBot/CBotToken.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // interpreter of the lanuage CBot for game COLOBOT diff --git a/src/CBot/CBotTwoOpExpr.cpp b/src/CBot/CBotTwoOpExpr.cpp index 4d4add8..e4e98ec 100644 --- a/src/CBot/CBotTwoOpExpr.cpp +++ b/src/CBot/CBotTwoOpExpr.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////// // expression of type Opérande1 + Opérande2 diff --git a/src/CBot/CBotVar.cpp b/src/CBot/CBotVar.cpp index b84006f..f696db7 100644 --- a/src/CBot/CBotVar.cpp +++ b/src/CBot/CBotVar.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ //////////////////////////////////////////////////////////////////// // Definition for the class CBotVar diff --git a/src/CBot/CBotWhile.cpp b/src/CBot/CBotWhile.cpp index 73bcab9..f94cf74 100644 --- a/src/CBot/CBotWhile.cpp +++ b/src/CBot/CBotWhile.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /////////////////////////////////////////////////////////////////////// // This file defined the following statements: diff --git a/src/CBot/ClassFILE.cpp b/src/CBot/ClassFILE.cpp deleted file mode 100644 index 6906bd4..0000000 --- a/src/CBot/ClassFILE.cpp +++ /dev/null @@ -1,426 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -// definition of methods for class FILE - - - -// Static variables - -static CBotClass* m_pClassFILE; -static CBotProgram* m_pFuncFile; -static int m_CompteurFileOpen = 0; - - - -// Prepares a file name. - -void PrepareFilename(CBotString &filename) //DD! -{ - int pos; - - pos = filename.ReverseFind('\\'); - if ( pos > 0 ) - { - filename = filename.Mid(pos+1); // remove the records (files)?? - } - - pos = filename.ReverseFind('/'); - if ( pos > 0 ) - { - filename = filename.Mid(pos+1); // also those with / - } - - pos = filename.ReverseFind(':'); - if ( pos > 0 ) - { - filename = filename.Mid(pos+1); // also removes the drive letter C: - } - - filename = CBotString("files\\") + filename; -} - - -// constructor of the class -// gets the filename as a parameter - -// execution -bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - CBotString mode; - - // accepts no parameters - if ( pVar == NULL ) return true; - - // must be a string - if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - - CBotString filename = pVar->GetValString(); - PrepareFilename(filename); //DR - - // there may be a second parameter - pVar = pVar->GetNext(); - if ( pVar != NULL ) - { - // recovers the mode - mode = pVar->GetValString(); - if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } - - // no third parameter, only two or one possible - if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } - } - - // save the file name - pVar = pThis->GetItem("filename"); - pVar->SetValString(filename); - - if ( ! mode.IsEmpty() ) - { - // open the called file - FILE* pFile = fopen( filename, mode ); - if ( pFile == NULL ) { Exception = CBotErrFileOpen; return false; } - - m_CompteurFileOpen ++; - - // save the handle of file - pVar = pThis->GetItem("handle"); - pVar->SetValInt((long)pFile); - } - - return true; -} - -// compilation -CBotTypResult cfconstruct (CBotVar* pThis, CBotVar* &pVar) -{ - // accepts no parameters - if ( pVar == NULL ) return CBotTypResult( 0 ); - - // must be a string - if ( pVar->GetType() != CBotTypString ) - return CBotTypResult( CBotErrBadString ); - - // there may be a second parameter - pVar = pVar->GetNext(); - if ( pVar != NULL ) - { - // must be a string - if ( pVar->GetType() != CBotTypString ) - return CBotTypResult( CBotErrBadString ); - // no third parameter - if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); - } - - // le r�sultat est de type void (constructeur) - return CBotTypResult( 0 ); -} - - -// destructor of the class - -// execution -bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - // not open? no problem - if ( pVar->GetInit() != IS_DEF) return true; - - FILE* pFile= (FILE*)pVar->GetValInt(); - fclose(pFile); - m_CompteurFileOpen --; - - pVar->SetInit(IS_NAN); - - return true; -} - - -// FILE :: open method -// get the r / w mode as a parameter - -// execution -bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // there must be a parameter - if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } - - // must be a string - if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - - // there may be a second parameter - if ( pVar->GetNext() != NULL ) - { - // in this case the first parameter is the file name - CBotString filename = pVar->GetValString(); - PrepareFilename(filename); //DR - - // saves the file name - CBotVar* pVar2 = pThis->GetItem("filename"); - pVar2->SetValString(filename); - - // next parameter is the mode - pVar = pVar -> GetNext(); - } - - CBotString mode = pVar->GetValString(); - if ( mode != "r" && mode != "w" ) { Exception = CBotErrBadParam; return false; } - - // No third parameter - if ( pVar->GetNext() != NULL ) { Exception = CBotErrOverParam; return false; } - - // retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - // which must not be initialized - if ( pVar->GetInit() == IS_DEF) { Exception = CBotErrFileOpen; return false; } - - // contains filename - pVar = pThis->GetItem("filename"); - CBotString filename = pVar->GetValString(); - - PrepareFilename(filename); //DD! (if the name was assigned by h.filename = "..."; - - // open requsted file - FILE* pFile = fopen( filename, mode ); - if ( pFile == NULL ) //DR - { - pResult->SetValInt(false); //DR - return true; //DR - } - - m_CompteurFileOpen ++; - - // saves the handle of file - pVar = pThis->GetItem("handle"); - pVar->SetValInt((long)pFile); - - pResult->SetValInt(true); //DR - return true; -} - -// compilation -CBotTypResult cfopen (CBotVar* pThis, CBotVar* &pVar) -{ - // there must be a parameter - if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); - - // must be a string - if ( pVar->GetType() != CBotTypString ) - return CBotTypResult( CBotErrBadString ); - - // there may be a second parameter - pVar = pVar->GetNext(); - if ( pVar != NULL ) - { - // must be a string - if ( pVar->GetType() != CBotTypString ) - return CBotTypResult( CBotErrBadString ); - - // no third parameter - if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); - } - - // the result is of type bool - return CBotTypResult(CBotTypBoolean); //DR -} - - -// FILE :: close method - -// execution -bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // it should not be any parameter - if ( pVar != NULL ) return CBotErrOverParam; - - // retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - - FILE* pFile= (FILE*)pVar->GetValInt(); - fclose(pFile); - m_CompteurFileOpen --; - - pVar->SetInit(IS_NAN); - - return true; -} - -// compilation -CBotTypResult cfclose (CBotVar* pThis, CBotVar* &pVar) -{ - // it should not be any parameter - if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam ); - - // function returns a result "void" - return CBotTypResult( 0 ); -} - -// FILE :: writeln method - -// execution -bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // there must be a parameter - if ( pVar == NULL ) { Exception = CBotErrLowParam; return false; } - - // must be a string - if ( pVar->GetType() != CBotTypString ) { Exception = CBotErrBadString; return false; } - - CBotString param = pVar->GetValString(); - - //retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - - FILE* pFile= (FILE*)pVar->GetValInt(); - - int res = fputs(param+CBotString("\n"), pFile); - - // on error throws an exception - if ( res < 0 ) { Exception = CBotErrWrite; return false; } - - return true; -} - -// compilation -CBotTypResult cfwrite (CBotVar* pThis, CBotVar* &pVar) -{ - // there must be a parameter - if ( pVar == NULL ) return CBotTypResult( CBotErrLowParam ); - - // must be a string - if ( pVar->GetType() != CBotTypString ) return CBotTypResult( CBotErrBadString ); - - // no other parameter - if ( pVar->GetNext() != NULL ) return CBotTypResult( CBotErrOverParam ); - - // function returns "void" result - return CBotTypResult( 0 ); -} - -// FILE :: readln method - -// execution -bool rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // there shouldn't be any parameter - if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } - - //retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - - FILE* pFile= (FILE*)pVar->GetValInt(); - - char chaine[2000]; - int i; - for ( i = 0 ; i < 2000 ; i++ ) chaine[i] = 0; - - fgets(chaine, 1999, pFile); - - for ( i = 0 ; i < 2000 ; i++ ) if (chaine[i] == '\n') chaine[i] = 0; - - // on error throws an exception - if ( ferror(pFile) ) { Exception = CBotErrRead; return false; } - - pResult->SetValString( chaine ); - - return true; -} - -// compilation -CBotTypResult cfread (CBotVar* pThis, CBotVar* &pVar) -{ - // there shouldn't be any parameter - if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam ); - - // function return "string" result - return CBotTypResult( CBotTypString ); -} -// FILE :: readln method - - -// execution -bool rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception) -{ - // there shouldn't be any parameter - if ( pVar != NULL ) { Exception = CBotErrOverParam; return false; } - - // retrieves the element "handle" - pVar = pThis->GetItem("handle"); - - if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; } - - FILE* pFile= (FILE*)pVar->GetValInt(); - - pResult->SetValInt( feof( pFile ) ); - - return true; -} - -// compilation -CBotTypResult cfeof (CBotVar* pThis, CBotVar* &pVar) -{ - // there shouldn't be any parameter - if ( pVar != NULL ) return CBotTypResult( CBotErrOverParam ); - - // function return boolean result - return CBotTypResult( CBotTypBoolean ); -} - - - - - -void InitClassFILE() -{ -// creates a class for file management -// the usage is as follows: -// file canal( "NomFichier.txt" ) -// canal.open( "r" ); // open reading -// s = canal.readln( ); // reads a line -// canal.close(); // closes the file - - // create class FILE - m_pClassFILE = new CBotClass("file", NULL); - // add the component ".filename" - m_pClassFILE->AddItem("filename", CBotTypString); - // add the component ".handle" - m_pClassFILE->AddItem("handle", CBotTypInt, PR_PRIVATE); - - // define a constructor and destructor - m_pClassFILE->AddFunction("file", rfconstruct, cfconstruct ); - m_pClassFILE->AddFunction("~file", rfdestruct, NULL ); - - // defined associated methods - m_pClassFILE->AddFunction("open", rfopen, cfopen ); - m_pClassFILE->AddFunction("close", rfclose, cfclose ); - m_pClassFILE->AddFunction("writeln", rfwrite, cfwrite ); - m_pClassFILE->AddFunction("readln", rfread, cfread ); - m_pClassFILE->AddFunction("eof", rfeof, cfeof ); - - m_pFuncFile = new CBotProgram( ); - CBotStringArray ListFonctions; - m_pFuncFile->Compile( "public file openfile(string name, string mode) {return new file(name, mode);}", ListFonctions); - m_pFuncFile->SetIdent(-2); // restoreState as a special identifier for this function -} - diff --git a/src/CBot/StringFunctions.cpp b/src/CBot/StringFunctions.cpp index abdcc18..d897c04 100644 --- a/src/CBot/StringFunctions.cpp +++ b/src/CBot/StringFunctions.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // definition of string functions diff --git a/src/CBot/resource.h b/src/CBot/resource.h index 9c7e82e..8b2e149 100644 --- a/src/CBot/resource.h +++ b/src/CBot/resource.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #pragma once diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12171f3..869f0cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -59,178 +59,208 @@ if(PLATFORM_WINDOWS) endif() # Source files -set(SOURCES -app/app.cpp -app/gamedata.cpp -app/main.cpp -app/pausemanager.cpp -app/system.cpp -app/${SYSTEM_CPP_MODULE} -app/system_other.cpp -common/event.cpp -common/image.cpp -common/iman.cpp -common/logger.cpp -common/misc.cpp -common/profile.cpp -common/restext.cpp -common/stringutils.cpp -graphics/core/color.cpp -graphics/engine/camera.cpp -graphics/engine/cloud.cpp -graphics/engine/engine.cpp -graphics/engine/lightman.cpp -graphics/engine/lightning.cpp -graphics/engine/modelfile.cpp -graphics/engine/modelmanager.cpp -graphics/engine/particle.cpp -graphics/engine/planet.cpp -graphics/engine/pyro.cpp -graphics/engine/terrain.cpp -graphics/engine/text.cpp -graphics/engine/water.cpp -graphics/opengl/gldevice.cpp -object/auto/auto.cpp -object/auto/autobase.cpp -object/auto/autoconvert.cpp -object/auto/autoderrick.cpp -object/auto/autodestroyer.cpp -object/auto/autoegg.cpp -object/auto/autoenergy.cpp -object/auto/autofactory.cpp -object/auto/autoflag.cpp -object/auto/autohuston.cpp -object/auto/autoinfo.cpp -object/auto/autojostle.cpp -object/auto/autokid.cpp -object/auto/autolabo.cpp -object/auto/automush.cpp -object/auto/autonest.cpp -object/auto/autonuclear.cpp -object/auto/autopara.cpp -object/auto/autoportico.cpp -object/auto/autoradar.cpp -object/auto/autorepair.cpp -object/auto/autoresearch.cpp -object/auto/autoroot.cpp -object/auto/autosafe.cpp -object/auto/autostation.cpp -object/auto/autotower.cpp -object/brain.cpp -object/mainmovie.cpp -object/motion/motion.cpp -object/motion/motionant.cpp -object/motion/motionbee.cpp -object/motion/motiondummy.cpp -object/motion/motionhuman.cpp -object/motion/motionmother.cpp -object/motion/motionspider.cpp -object/motion/motiontoto.cpp -object/motion/motionvehicle.cpp -object/motion/motionworm.cpp -object/object.cpp -object/robotmain.cpp -object/objman.cpp -object/task/task.cpp -object/task/taskadvance.cpp -object/task/taskbuild.cpp -object/task/taskfire.cpp -object/task/taskfireant.cpp -object/task/taskflag.cpp -object/task/taskgoto.cpp -object/task/taskgungoal.cpp -object/task/taskinfo.cpp -object/task/taskmanager.cpp -object/task/taskmanip.cpp -object/task/taskpen.cpp -object/task/taskrecover.cpp -object/task/taskreset.cpp -object/task/tasksearch.cpp -object/task/taskshield.cpp -object/task/taskspiderexplo.cpp -object/task/tasktake.cpp -object/task/taskterraform.cpp -object/task/taskturn.cpp -object/task/taskwait.cpp -physics/physics.cpp -script/cbottoken.cpp -script/cmdtoken.cpp -script/script.cpp -sound/sound.cpp -ui/button.cpp -ui/check.cpp -ui/color.cpp -ui/compass.cpp -ui/control.cpp -ui/displayinfo.cpp -ui/displaytext.cpp -ui/edit.cpp -ui/editvalue.cpp -ui/gauge.cpp -ui/group.cpp -ui/image.cpp -ui/interface.cpp -ui/key.cpp -ui/label.cpp -ui/list.cpp -ui/maindialog.cpp -ui/mainmap.cpp -ui/mainshort.cpp -ui/map.cpp -ui/scroll.cpp -ui/shortcut.cpp -ui/slider.cpp -ui/studio.cpp -ui/target.cpp -ui/window.cpp -${OPENAL_SRC} -${RES_FILES} +set(BASE_SOURCES + app/app.cpp + app/pausemanager.cpp + app/system.cpp + app/${SYSTEM_CPP_MODULE} + app/system_other.cpp + common/event.cpp + common/image.cpp + common/iman.cpp + common/logger.cpp + common/misc.cpp + common/profile.cpp + common/restext.cpp + common/stringutils.cpp + common/resources/resourcemanager.cpp + common/resources/inputstreambuffer.cpp + common/resources/outputstreambuffer.cpp + common/resources/inputstream.cpp + common/resources/outputstream.cpp + common/resources/sndfile.cpp + graphics/core/color.cpp + graphics/engine/camera.cpp + graphics/engine/cloud.cpp + graphics/engine/engine.cpp + graphics/engine/lightman.cpp + graphics/engine/lightning.cpp + graphics/engine/modelfile.cpp + graphics/engine/modelmanager.cpp + graphics/engine/particle.cpp + graphics/engine/planet.cpp + graphics/engine/pyro.cpp + graphics/engine/terrain.cpp + graphics/engine/text.cpp + graphics/engine/water.cpp + graphics/opengl/gldevice.cpp + object/auto/auto.cpp + object/auto/autobase.cpp + object/auto/autoconvert.cpp + object/auto/autoderrick.cpp + object/auto/autodestroyer.cpp + object/auto/autoegg.cpp + object/auto/autoenergy.cpp + object/auto/autofactory.cpp + object/auto/autoflag.cpp + object/auto/autohuston.cpp + object/auto/autoinfo.cpp + object/auto/autojostle.cpp + object/auto/autokid.cpp + object/auto/autolabo.cpp + object/auto/automush.cpp + object/auto/autonest.cpp + object/auto/autonuclear.cpp + object/auto/autopara.cpp + object/auto/autoportico.cpp + object/auto/autoradar.cpp + object/auto/autorepair.cpp + object/auto/autoresearch.cpp + object/auto/autoroot.cpp + object/auto/autosafe.cpp + object/auto/autostation.cpp + object/auto/autotower.cpp + object/brain.cpp + object/level/parser.cpp + object/level/parserline.cpp + object/level/parserparam.cpp + object/level/parserexceptions.cpp + object/mainmovie.cpp + object/motion/motion.cpp + object/motion/motionant.cpp + object/motion/motionbee.cpp + object/motion/motiondummy.cpp + object/motion/motionhuman.cpp + object/motion/motionmother.cpp + object/motion/motionspider.cpp + object/motion/motiontoto.cpp + object/motion/motionvehicle.cpp + object/motion/motionworm.cpp + object/object.cpp + object/robotmain.cpp + object/objman.cpp + object/task/task.cpp + object/task/taskadvance.cpp + object/task/taskbuild.cpp + object/task/taskfire.cpp + object/task/taskfireant.cpp + object/task/taskflag.cpp + object/task/taskgoto.cpp + object/task/taskgungoal.cpp + object/task/taskinfo.cpp + object/task/taskmanager.cpp + object/task/taskmanip.cpp + object/task/taskpen.cpp + object/task/taskrecover.cpp + object/task/taskreset.cpp + object/task/tasksearch.cpp + object/task/taskshield.cpp + object/task/taskspiderexplo.cpp + object/task/tasktake.cpp + object/task/taskterraform.cpp + object/task/taskturn.cpp + object/task/taskwait.cpp + physics/physics.cpp + script/cbottoken.cpp + script/cmdtoken.cpp + script/script.cpp + sound/sound.cpp + ui/button.cpp + ui/check.cpp + ui/color.cpp + ui/compass.cpp + ui/control.cpp + ui/displayinfo.cpp + ui/displaytext.cpp + ui/edit.cpp + ui/editvalue.cpp + ui/gauge.cpp + ui/group.cpp + ui/image.cpp + ui/interface.cpp + ui/key.cpp + ui/label.cpp + ui/list.cpp + ui/maindialog.cpp + ui/mainmap.cpp + ui/mainshort.cpp + ui/map.cpp + ui/scroll.cpp + ui/shortcut.cpp + ui/slider.cpp + ui/studio.cpp + ui/target.cpp + ui/window.cpp + ${OPENAL_SRC} + ${RES_FILES} +) + +set(MAIN_SOURCES + app/main.cpp ) +# Libraries set(LIBS -CBot -clipboard -localename -${SDL_LIBRARY} -${SDLIMAGE_LIBRARY} -${SDLTTF_LIBRARY} -${OPENGL_LIBRARY} -${PNG_LIBRARIES} -${GLEW_LIBRARY} -${Boost_LIBRARIES} -${LIBSNDFILE_LIBRARY} -${OPTIONAL_LIBS} -${PLATFORM_LIBS} + CBot + clipboard + localename + ${SDL_LIBRARY} + ${SDLIMAGE_LIBRARY} + ${SDLTTF_LIBRARY} + ${OPENGL_LIBRARY} + ${PNG_LIBRARIES} + ${GLEW_LIBRARY} + ${Boost_LIBRARIES} + ${LIBSNDFILE_LIBRARY} + ${OPTIONAL_LIBS} + ${PLATFORM_LIBS} +${PHYSFS_LIBRARY} +) + +set(COLOBOT_LIBS ${LIBS} PARENT_SCOPE) + + +# Includes +set(LOCAL_INCLUDES + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_CURRENT_BINARY_DIR} ) -# Local -include_directories( -. -.. -${CMAKE_CURRENT_BINARY_DIR} +set(SYSTEM_INCLUDES + ${SDL_INCLUDE_DIR} + ${SDLIMAGE_INCLUDE_DIR} + ${SDLTTF_INCLUDE_DIR} + ${PNG_INCLUDE_DIRS} + ${GLEW_INCLUDE_PATH} + ${Boost_INCLUDE_DIRS} + ${LIBSNDFILE_INCLUDE_DIR} + ${LOCALENAME_INCLUDE_DIR} + ${OPTIONAL_INCLUDE_DIRS} + ${CLIPBOARD_INCLUDE_DIR} +${PHYSFS_INCLUDE_PATH} ) -# System -include_directories( -SYSTEM -${SDL_INCLUDE_DIR} -${SDLIMAGE_INCLUDE_DIR} -${SDLTTF_INCLUDE_DIR} -${PNG_INCLUDE_DIRS} -${GLEW_INCLUDE_PATH} -${Boost_INCLUDE_DIRS} -${LIBSNDFILE_INCLUDE_DIR} -${LOCALENAME_INCLUDE_DIR} -${OPTIONAL_INCLUDE_DIRS} -${CLIPBOARD_INCLUDE_DIR} +set(COLOBOT_LOCAL_INCLUDES ${LOCAL_INCLUDES} PARENT_SCOPE) +set(COLOBOT_SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE) + +include_directories(${LOCAL_INCLUDES}) +include_directories(SYSTEM ${SYSTEM_INCLUDES}) + + +# Link directories +link_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/CBot ) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/CBot) -add_executable(colobot ${SOURCES}) +# Targets + +add_library(colobotbase STATIC ${BASE_SOURCES}) -target_link_libraries(colobot ${LIBS}) +add_executable(colobot ${MAIN_SOURCES}) +target_link_libraries(colobot colobotbase ${LIBS}) install(TARGETS colobot RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR}) if(NOT CBOT_STATIC) diff --git a/src/app/app.cpp b/src/app/app.cpp index 8b310c9..1b53a28 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1,25 +1,26 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/config.h" #include "app/app.h" -#include "app/gamedata.h" #include "app/system.h" #include "common/logger.h" @@ -27,6 +28,7 @@ #include "common/image.h" #include "common/key.h" #include "common/stringutils.h" +#include "common/resources/resourcemanager.h" #include "graphics/engine/modelmanager.h" #include "graphics/opengl/gldevice.h" @@ -101,7 +103,6 @@ CApplication::CApplication() m_objMan = new CObjectManager(); m_eventQueue = new CEventQueue(); m_profile = new CProfile(); - m_gameData = new CGameData(); m_engine = nullptr; m_device = nullptr; @@ -112,9 +113,8 @@ CApplication::CApplication() m_exitCode = 0; m_active = false; m_debugModes = 0; - m_customDataPath = false; - m_windowTitle = "COLOBOT GOLD"; + m_windowTitle = "COLOBOT: Gold Edition"; m_simulationSuspended = false; @@ -149,12 +149,23 @@ CApplication::CApplication() m_mouseButtonsState = 0; m_trackedKeys = 0; + #ifdef PORTABLE + m_dataPath = "./data"; + m_langPath = "./lang"; + #else m_dataPath = GetSystemUtils()->GetDataPath(); m_langPath = GetSystemUtils()->GetLangPath(); + #endif + + #ifdef DEV_BUILD + m_savePath = "./saves"; + #else + m_savePath = GetSystemUtils()->GetSaveDir(); + #endif m_runSceneName = ""; m_runSceneRank = 0; - + m_sceneTest = false; m_language = LANGUAGE_ENV; @@ -180,9 +191,6 @@ CApplication::~CApplication() delete m_iMan; m_iMan = nullptr; - - delete m_gameData; - m_gameData = nullptr; GetSystemUtils()->DestroyTimeStamp(m_baseTimeStamp); GetSystemUtils()->DestroyTimeStamp(m_curTimeStamp); @@ -215,9 +223,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) OPT_SCENETEST, OPT_LOGLEVEL, OPT_LANGUAGE, + OPT_LANGDIR, OPT_DATADIR, + OPT_SAVEDIR, OPT_MOD, - OPT_LANGDIR, OPT_VBO }; @@ -229,9 +238,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) { "scenetest", no_argument, nullptr, OPT_SCENETEST }, { "loglevel", required_argument, nullptr, OPT_LOGLEVEL }, { "language", required_argument, nullptr, OPT_LANGUAGE }, + { "langdir", required_argument, nullptr, OPT_LANGDIR }, { "datadir", required_argument, nullptr, OPT_DATADIR }, + { "savedir", required_argument, nullptr, OPT_SAVEDIR }, { "mod", required_argument, nullptr, OPT_MOD }, - { "langdir", required_argument, nullptr, OPT_LANGDIR }, { "vbo", required_argument, nullptr, OPT_VBO }, { nullptr, 0, nullptr, 0} }; @@ -269,9 +279,10 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) GetLogger()->Message(" -scenetest win every mission right after it's loaded\n"); GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n"); GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl, ru)\n"); - GetLogger()->Message(" -datadir path set custom data directory path\n"); - GetLogger()->Message(" -mod path run mod\n"); GetLogger()->Message(" -langdir path set custom language directory path\n"); + GetLogger()->Message(" -datadir path set custom data directory path\n"); + GetLogger()->Message(" -savedir path set custom save directory path (must be writable)\n"); + GetLogger()->Message(" -mod path load datadir mod from given path\n"); GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n"); return PARSE_ARGS_HELP; } @@ -334,25 +345,6 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) m_language = language; break; } - case OPT_DATADIR: - { - m_dataPath = optarg; - m_customDataPath = true; - GetLogger()->Info("Using datadir: '%s'\n", optarg); - break; - } - case OPT_MOD: - { - m_gameData->AddMod(std::string(optarg)); - GetLogger()->Info("Running mod from path: '%s'\n", optarg); - break; - } - case OPT_LANGDIR: - { - m_langPath = optarg; - GetLogger()->Info("Using language dir: '%s'\n", m_langPath.c_str()); - break; - } case OPT_VBO: { std::string vbo; @@ -371,6 +363,30 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) break; } + case OPT_DATADIR: + { + m_dataPath = optarg; + GetLogger()->Info("Using data dir: '%s'\n", optarg); + break; + } + case OPT_LANGDIR: + { + m_langPath = optarg; + GetLogger()->Info("Using language dir: '%s'\n", optarg); + break; + } + case OPT_SAVEDIR: + { + m_savePath = optarg; + GetLogger()->Info("Using save dir: '%s'\n", optarg); + break; + } + case OPT_MOD: + { + GetLogger()->Info("Loading mod: '%s'\n", optarg); + CResourceManager::AddLocation(optarg, true); + break; + } default: assert(false); // should never get here } @@ -386,32 +402,34 @@ bool CApplication::Create() GetLogger()->Info("Creating CApplication\n"); - if (!GetProfile().InitCurrentDirectory()) - { - GetLogger()->Warn("Config not found. Default values will be used!\n"); - defaultValues = true; - } - else - { - if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Data", path)) - m_dataPath = path; - } - boost::filesystem::path dataPath(m_dataPath); if (! (boost::filesystem::exists(dataPath) && boost::filesystem::is_directory(dataPath)) ) { GetLogger()->Error("Data directory '%s' doesn't exist or is not a directory\n", m_dataPath.c_str()); m_errorMessage = std::string("Could not read from data directory:\n") + - std::string("'") + m_dataPath + std::string("'\n") + - std::string("Please check your installation, or supply a valid data directory by -datadir option."); + std::string("'") + m_dataPath + std::string("'\n") + + std::string("Please check your installation, or supply a valid data directory by -datadir option."); m_exitCode = 1; return false; } - - m_gameData->SetDataDir(std::string(m_dataPath)); - m_gameData->Init(); - if (GetProfile().GetLocalProfileString("Language", "Lang", path)) { + boost::filesystem::create_directories(m_savePath); + boost::filesystem::create_directories(m_savePath+"/mods"); + + LoadModsFromDir(m_dataPath+"/mods"); + LoadModsFromDir(m_savePath+"/mods"); + + CResourceManager::AddLocation(m_dataPath, false); + CResourceManager::SetSaveLocation(m_savePath); + CResourceManager::AddLocation(m_savePath, true); + + if (!GetProfile().Init()) + { + GetLogger()->Warn("Config not found. Default values will be used!\n"); + defaultValues = true; + } + + if (GetProfile().GetStringProperty("Language", "Lang", path)) { Language language; if (ParseLanguage(path, language)) { m_language = language; @@ -472,7 +490,7 @@ bool CApplication::Create() // load settings from profile int iValue; - if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) ) { std::vector<Math::IntPoint> modes; GetVideoResolutionList(modes, true, true); @@ -480,7 +498,7 @@ bool CApplication::Create() m_deviceConfig.size = modes.at(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) ) { m_deviceConfig.fullScreen = (iValue == 1); } @@ -568,8 +586,8 @@ bool CApplication::CreateVideoSurface() if (m_deviceConfig.fullScreen) videoFlags |= SDL_FULLSCREEN; - if (m_deviceConfig.resizeable) - videoFlags |= SDL_RESIZABLE; + //if (m_deviceConfig.resizeable) + // videoFlags |= SDL_RESIZABLE; // Set OpenGL attributes @@ -594,27 +612,35 @@ bool CApplication::CreateVideoSurface() return true; } +void CApplication::LoadModsFromDir(const std::string &dir) +{ + try { + boost::filesystem::directory_iterator iterator(dir); + for(; iterator != boost::filesystem::directory_iterator(); ++iterator) + { + std::string fn = iterator->path().string(); + CLogger::GetInstancePointer()->Info("Loading mod: '%s'\n", fn.c_str()); + CResourceManager::AddLocation(fn, false); + } + } + catch(std::exception &e) + { + CLogger::GetInstancePointer()->Warn("Unable to load mods from directory '%s': %s\n", dir.c_str(), e.what()); + } +} + void CApplication::Destroy() { m_joystickEnabled = false; - if (m_robotMain != nullptr) - { - delete m_robotMain; - m_robotMain = nullptr; - } + delete m_robotMain; + m_robotMain = nullptr; - if (m_sound != nullptr) - { - delete m_sound; - m_sound = nullptr; - } + delete m_sound; + m_sound = nullptr; - if (m_modelManager != nullptr) - { - delete m_modelManager; - m_modelManager = nullptr; - } + delete m_modelManager; + m_modelManager = nullptr; if (m_engine != nullptr) { @@ -674,7 +700,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig) std::string(SDL_GetError()) + std::string("\n") + std::string("Previous mode will be restored"); GetLogger()->Error(error.c_str()); - GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Error", error); + GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Error", error); restore = true; ChangeVideoConfig(m_lastDeviceConfig); @@ -687,7 +713,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig) std::string error = std::string("SDL error while restoring previous video mode:\n") + std::string(SDL_GetError()); GetLogger()->Error(error.c_str()); - GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBT - Fatal Error", error); + GetSystemUtils()->SystemDialog( SDT_ERROR, "COLOBOT - Fatal Error", error); // Fatal error, so post the quit event @@ -699,6 +725,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig) ( static_cast<Gfx::CGLDevice*>(m_device) )->ConfigChanged(m_deviceConfig); m_engine->ResetAfterDeviceChanged(); + m_robotMain->ResetAfterDeviceChanged(); return true; } diff --git a/src/app/app.h b/src/app/app.h index 86a757f..c73cb53 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/app.h @@ -42,7 +44,6 @@ class CInstanceManager; class CEventQueue; class CRobotMain; class CSoundInterface; -class CGameData; namespace Gfx { class CModelManager; @@ -355,6 +356,9 @@ public: protected: //! Creates the window's SDL_Surface bool CreateVideoSurface(); + + //! Loads all mods from given directory + void LoadModsFromDir(const std::string &dir); //! Processes the captured SDL event to Event struct Event ProcessSystemEvent(); @@ -402,8 +406,6 @@ protected: CRobotMain* m_robotMain; //! Profile (INI) reader/writer CProfile* m_profile; - //! Game data - CGameData* m_gameData; //! Code to return at exit int m_exitCode; @@ -467,16 +469,16 @@ protected: std::vector<int> m_joyAxeState; //! Current state of joystick buttons; may be updated from another thread std::vector<bool> m_joyButtonState; - + //! Path to directory with data files std::string m_dataPath; - - //! True if datadir was passed in command line - bool m_customDataPath; - + //! Path to directory with language files std::string m_langPath; + //! Path to directory with save files + std::string m_savePath; + //@{ //! Scene to run on startup std::string m_runSceneName; diff --git a/src/app/gamedata.cpp b/src/app/gamedata.cpp deleted file mode 100644 index ceeb7b3..0000000 --- a/src/app/gamedata.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2014, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -#include "app/gamedata.h" - - -#include "app/app.h" - -#include <boost/filesystem.hpp> - -template<> CGameData* CSingleton<CGameData>::m_instance = nullptr; - -CGameData::CGameData() -{ - m_dataDirSet = false; - - for (int i = 0; i < DIR_MAX; ++i) - m_standardDataDirs[i] = nullptr; - - m_standardDataDirs[DIR_AI] = "ai"; - m_standardDataDirs[DIR_FONT] = "fonts"; - m_standardDataDirs[DIR_HELP] = "help"; - m_standardDataDirs[DIR_ICON] = "icons"; - m_standardDataDirs[DIR_LEVEL] = "levels"; - m_standardDataDirs[DIR_MODEL] = "models"; - m_standardDataDirs[DIR_MUSIC] = "music"; - m_standardDataDirs[DIR_SOUND] = "sounds"; - m_standardDataDirs[DIR_TEXTURE] = "textures"; -} - -CGameData::~CGameData() -{ -} - -void CGameData::SetDataDir(std::string path) -{ - assert(!m_dataDirSet); - m_dataDirSet = true; - - m_dataDirs.insert(m_dataDirs.begin(), path); -} - -void CGameData::AddMod(std::string path) -{ - m_dataDirs.push_back(path); -} - -void CGameData::Init() -{ - std::string out = "Using datadirs: "; - bool first = true; - for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) { - if(!first) out += ", "; - first = false; - out += *rit; - } - out += "\n"; - CLogger::GetInstancePointer()->Info(out.c_str()); -} - -std::string CGameData::GetFilePath(DataDir dir, const std::string& subpath) -{ - int index = static_cast<int>(dir); - assert(index >= 0 && index < DIR_MAX); - - for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) { - std::stringstream str; - - if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot - str << *rit; - str << "/"; - str << m_standardDataDirs[index]; - - if (dir == DIR_HELP) - { - str << "/"; - str << CApplication::GetInstancePointer()->GetLanguageChar(); - } - str << "/"; - } - - str << subpath; - - boost::filesystem::path path(str.str()); - if(boost::filesystem::exists(path)) - { - return str.str(); - } - } - - if(m_dataDirs.size() > 0) { - std::stringstream str; - if ( subpath.find("save") == std::string::npos ){ // if its NOT a path to a savefile screenshot - str << m_dataDirs[0]; - str << "/"; - str << m_standardDataDirs[index]; - - if (dir == DIR_HELP) - { - str << "/"; - str << CApplication::GetInstancePointer()->GetLanguageChar(); - } - str << "/"; - } - str << subpath; - return str.str(); - } - - return subpath; -} - -std::string CGameData::GetDataPath(const std::string &subpath) -{ - for(std::vector<std::string>::reverse_iterator rit = m_dataDirs.rbegin(); rit != m_dataDirs.rend(); ++rit) { - std::string path = *rit + "/" + subpath; - boost::filesystem::path boostPath(path); - if(boost::filesystem::exists(boostPath)) - { - return path; - } - } - return m_dataDirs[0] + "/" + subpath; -} diff --git a/src/app/gamedata.h b/src/app/gamedata.h deleted file mode 100644 index b7536a2..0000000 --- a/src/app/gamedata.h +++ /dev/null @@ -1,66 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2014, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. - -/** - * \file app/gamedata.h - * \brief Game data - */ - -#pragma once - -#include "common/singleton.h" - -#include <string> -#include <vector> - -/** - * \enum DataDir - * \brief Directories in data directory - */ -enum DataDir -{ - DIR_AI, //! < ai scripts - DIR_FONT, //! < fonts - DIR_HELP, //! < help files - DIR_ICON, //! < icons & images - DIR_LEVEL, //! < levels - DIR_MODEL, //! < models - DIR_MUSIC, //! < music - DIR_SOUND, //! < sounds - DIR_TEXTURE, //! < textures - - DIR_MAX //! < number of dirs -}; - -class CGameData : public CSingleton<CGameData> -{ -public: - CGameData(); - ~CGameData(); - - void Init(); - void SetDataDir(std::string path); - void AddMod(std::string path); - - std::string GetFilePath(DataDir dir, const std::string &subpath); - std::string GetDataPath(const std::string &subpath); - -private: - bool m_dataDirSet; - std::vector<std::string> m_dataDirs; - const char* m_standardDataDirs[DIR_MAX]; -}; - diff --git a/src/app/main.cpp b/src/app/main.cpp index 5c0afd3..e30a83d 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/main.cpp @@ -69,6 +71,7 @@ The current layout is the following: - src/script - link with the CBot library */ +#include "common/resources/resourcemanager.h" //! Entry point to the program extern "C" @@ -77,6 +80,7 @@ extern "C" int SDL_MAIN_FUNC(int argc, char *argv[]) { CLogger logger; // single istance of logger + CResourceManager manager(argv[0]); // Initialize static string arrays InitializeRestext(); diff --git a/src/app/pausemanager.cpp b/src/app/pausemanager.cpp index d357bba..b28565f 100644 --- a/src/app/pausemanager.cpp +++ b/src/app/pausemanager.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/app.h" #include "app/pausemanager.h" @@ -29,7 +31,7 @@ template<> CPauseManager* CSingleton<CPauseManager>::m_instance = nullptr; CPauseManager::CPauseManager() { m_sound = CApplication::GetInstancePointer()->GetSound(); - + m_pause = PAUSE_NONE; } @@ -40,24 +42,28 @@ CPauseManager::~CPauseManager() void CPauseManager::SetPause(PauseType pause) { - if(pause != PAUSE_NONE) { - if(m_pause != pause) { + if (pause != PAUSE_NONE) + { + if (m_pause != pause) + { CLogger::GetInstancePointer()->Info("Game paused - %s\n", GetPauseName(pause).c_str()); CRobotMain::GetInstancePointer()->StartPauseMusic(pause); } - + m_pause = pause; - } else + } + else ClearPause(); } void CPauseManager::ClearPause() { - if(m_pause != PAUSE_NONE) { + if(m_pause != PAUSE_NONE) + { CLogger::GetInstancePointer()->Info("Game resumed\n"); m_sound->StopPauseMusic(); } - + m_pause = PAUSE_NONE; } diff --git a/src/app/pausemanager.h b/src/app/pausemanager.h index fefc4a5..411742e 100644 --- a/src/app/pausemanager.h +++ b/src/app/pausemanager.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/pausemanager.h diff --git a/src/app/system.cpp b/src/app/system.cpp index eaa9e4c..2ceea6a 100644 --- a/src/app/system.cpp +++ b/src/app/system.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/system.h" @@ -202,13 +204,7 @@ std::string CSystemUtils::GetLangPath() return COLOBOT_I18N_DIR; } -std::string CSystemUtils::GetProfileFileLocation() +std::string CSystemUtils::GetSaveDir() { - return std::string("colobot.ini"); + return std::string("save"); } - -std::string CSystemUtils::GetSavegameDirectoryLocation() -{ - return std::string("savegame"); -} - diff --git a/src/app/system.h b/src/app/system.h index c2125fe..d52020b 100644 --- a/src/app/system.h +++ b/src/app/system.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/system.h @@ -136,11 +138,8 @@ public: //! Returns the translations path virtual std::string GetLangPath(); - //! Returns the profile (colobot.ini) file location - virtual std::string GetProfileFileLocation(); - - //! Returns the savegame directory location - virtual std::string GetSavegameDirectoryLocation(); + //! Returns the save dir location + virtual std::string GetSaveDir(); }; //! Global function to get CSystemUtils instance diff --git a/src/app/system_linux.cpp b/src/app/system_linux.cpp index 492af7d..6fbfb05 100644 --- a/src/app/system_linux.cpp +++ b/src/app/system_linux.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/system_linux.h" @@ -25,7 +27,7 @@ void CSystemUtilsLinux::Init() { m_zenityAvailable = true; - if (system("zenity --version") != 0) + if (system("zenity --version 1> /dev/null 2> /dev/null") != 0) { m_zenityAvailable = false; GetLogger()->Warn("Zenity not available, will fallback to console users dialogs.\n"); @@ -95,34 +97,7 @@ long long CSystemUtilsLinux::TimeStampExactDiff(SystemTimeStamp *before, SystemT (after->clockTime.tv_sec - before->clockTime.tv_sec) * 1000000000ll; } -std::string CSystemUtilsLinux::GetProfileFileLocation() -{ - std::string profileFile; - - // Determine profileFile according to XDG Base Directory Specification - char* envXDG_CONFIG_HOME = getenv("XDG_CONFIG_HOME"); - if (envXDG_CONFIG_HOME == NULL) - { - char *envHOME = getenv("HOME"); - if (envHOME == NULL) - { - profileFile = "colobot.ini"; - } - else - { - profileFile = std::string(envHOME) + "/.config/colobot.ini"; - } - } - else - { - profileFile = std::string(envXDG_CONFIG_HOME) + "/colobot.ini"; - } - GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str()); - - return profileFile; -} - -std::string CSystemUtilsLinux::GetSavegameDirectoryLocation() +std::string CSystemUtilsLinux::GetSaveDir() { std::string savegameDir; @@ -133,7 +108,7 @@ std::string CSystemUtilsLinux::GetSavegameDirectoryLocation() char *envHOME = getenv("HOME"); if (envHOME == NULL) { - savegameDir = "/tmp/colobot-savegame"; + savegameDir = "/tmp/colobot-save"; } else { @@ -148,4 +123,3 @@ std::string CSystemUtilsLinux::GetSavegameDirectoryLocation() return savegameDir; } - diff --git a/src/app/system_linux.h b/src/app/system_linux.h index 212d840..5f4fcc3 100644 --- a/src/app/system_linux.h +++ b/src/app/system_linux.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/system_linux.h @@ -46,8 +48,7 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; - virtual std::string GetProfileFileLocation() override; - virtual std::string GetSavegameDirectoryLocation() override; + virtual std::string GetSaveDir() override; private: bool m_zenityAvailable; diff --git a/src/app/system_macosx.cpp b/src/app/system_macosx.cpp index 68f5c79..208b4a7 100644 --- a/src/app/system_macosx.cpp +++ b/src/app/system_macosx.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2013, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/system_macosx.h" @@ -97,20 +99,10 @@ std::string CSystemUtilsMacOSX::GetLangPath() return m_dataPath + "/i18n"; } -std::string CSystemUtilsMacOSX::GetProfileFileLocation() +std::string CSystemUtilsMacOSX::GetSaveDir() { - std::string profileFile = m_ASPath + "/colobot.ini"; - - GetLogger()->Trace("Profile file is %s\n", profileFile.c_str()); - return profileFile; -} - -std::string CSystemUtilsMacOSX::GetSavegameDirectoryLocation() -{ - std::string savegameDir = m_ASPath + "/savegame"; - boost::filesystem::create_directories(savegameDir.c_str()); + std::string savegameDir = m_ASPath; GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); return savegameDir; } - diff --git a/src/app/system_macosx.h b/src/app/system_macosx.h index b6a044b..9063aab 100644 --- a/src/app/system_macosx.h +++ b/src/app/system_macosx.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/system_macosx.h @@ -30,8 +32,7 @@ public: virtual std::string GetDataPath() override; virtual std::string GetLangPath() override; - virtual std::string GetProfileFileLocation() override; - virtual std::string GetSavegameDirectoryLocation() override; + virtual std::string GetSaveDir() override; private: std::string m_ASPath; std::string m_dataPath; diff --git a/src/app/system_other.cpp b/src/app/system_other.cpp index 9d9f76a..c21314c 100644 --- a/src/app/system_other.cpp +++ b/src/app/system_other.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/system_other.h" diff --git a/src/app/system_other.h b/src/app/system_other.h index 7eccf3f..3be6d59 100644 --- a/src/app/system_other.h +++ b/src/app/system_other.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/system_other.h diff --git a/src/app/system_windows.cpp b/src/app/system_windows.cpp index f48d4e0..a2ea18f 100644 --- a/src/app/system_windows.cpp +++ b/src/app/system_windows.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "app/system_windows.h" @@ -111,39 +113,20 @@ std::wstring CSystemUtilsWindows::UTF8_Decode(const std::string& str) } -std::string CSystemUtilsWindows::GetProfileFileLocation() -{ - std::string profileFile; - - char* envUSERPROFILE = getenv("USERPROFILE"); - if (envUSERPROFILE == NULL) - { - profileFile = "colobot.ini"; - } - else - { - profileFile = std::string(envUSERPROFILE) + "\\colobot\\colobot.ini"; - } - GetLogger()->Trace("Profile configuration is %s\n", profileFile.c_str()); - - return profileFile; -} - -std::string CSystemUtilsWindows::GetSavegameDirectoryLocation() +std::string CSystemUtilsWindows::GetSaveDir() { std::string savegameDir; char* envUSERPROFILE = getenv("USERPROFILE"); if (envUSERPROFILE == NULL) { - savegameDir = "savegame"; + savegameDir = "save"; } else { - savegameDir = std::string(envUSERPROFILE) + "\\colobot\\savegame"; + savegameDir = std::string(envUSERPROFILE) + "\\colobot"; } GetLogger()->Trace("Saved game files are going to %s\n", savegameDir.c_str()); return savegameDir; } - diff --git a/src/app/system_windows.h b/src/app/system_windows.h index fbc71a1..9175a44 100644 --- a/src/app/system_windows.h +++ b/src/app/system_windows.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file app/system_windows.h @@ -44,8 +46,7 @@ public: virtual long long GetTimeStampExactResolution() override; virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override; - virtual std::string GetProfileFileLocation() override; - virtual std::string GetSavegameDirectoryLocation() override; + virtual std::string GetSaveDir() override; private: std::string UTF8_Encode(const std::wstring &wstr); diff --git a/src/common/config.h.cmake b/src/common/config.h.cmake index 98ccefe..44c1085 100644 --- a/src/common/config.h.cmake +++ b/src/common/config.h.cmake @@ -24,6 +24,8 @@ #define SDL_MAIN_FUNC main #endif +#cmakedefine PORTABLE @PORTABLE@ + #define COLOBOT_VERSION "@COLOBOT_VERSION_FULL@" #define COLOBOT_CODENAME "@COLOBOT_VERSION_CODENAME@" #define COLOBOT_FULLNAME "Colobot @COLOBOT_VERSION_CODENAME@" diff --git a/src/common/event.cpp b/src/common/event.cpp index 9dc3943..37a6fe8 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/event.h" @@ -67,7 +70,6 @@ void InitializeEventTypeTexts() EVENT_TYPE_TEXT[EVENT_BUTTON_CANCEL] = "EVENT_BUTTON_CANCEL"; EVENT_TYPE_TEXT[EVENT_BUTTON_NEXT] = "EVENT_BUTTON_NEXT"; EVENT_TYPE_TEXT[EVENT_BUTTON_PREV] = "EVENT_BUTTON_PREV"; - EVENT_TYPE_TEXT[EVENT_BUTTON_QUIT] = "EVENT_BUTTON_QUIT"; EVENT_TYPE_TEXT[EVENT_BUTTON0] = "EVENT_BUTTON0"; EVENT_TYPE_TEXT[EVENT_BUTTON1] = "EVENT_BUTTON1"; @@ -170,7 +172,6 @@ void InitializeEventTypeTexts() EVENT_TYPE_TEXT[EVENT_INTERFACE_READ] = "EVENT_INTERFACE_READ"; EVENT_TYPE_TEXT[EVENT_INTERFACE_ABORT] = "EVENT_INTERFACE_ABORT"; EVENT_TYPE_TEXT[EVENT_INTERFACE_USER] = "EVENT_INTERFACE_USER"; - EVENT_TYPE_TEXT[EVENT_INTERFACE_TEEN] = "EVENT_INTERFACE_TEEN"; EVENT_TYPE_TEXT[EVENT_INTERFACE_CHAP] = "EVENT_INTERFACE_CHAP"; EVENT_TYPE_TEXT[EVENT_INTERFACE_LIST] = "EVENT_INTERFACE_LIST"; diff --git a/src/common/event.h b/src/common/event.h index 1df675e..bb9e123 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/event.h @@ -90,7 +93,6 @@ enum EventType EVENT_BUTTON_CANCEL = 41, EVENT_BUTTON_NEXT = 42, EVENT_BUTTON_PREV = 43, - EVENT_BUTTON_QUIT = 44, EVENT_BUTTON0 = 50, EVENT_BUTTON1 = 51, @@ -193,7 +195,6 @@ enum EventType EVENT_INTERFACE_READ = 411, EVENT_INTERFACE_ABORT = 412, EVENT_INTERFACE_USER = 413, - EVENT_INTERFACE_TEEN = 414, EVENT_INTERFACE_CHAP = 420, EVENT_INTERFACE_LIST = 421, diff --git a/src/common/global.h b/src/common/global.h index 4049bdc..b41ea53 100644 --- a/src/common/global.h +++ b/src/common/global.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/global.h diff --git a/src/common/image.cpp b/src/common/image.cpp index e3d1ef7..f241f83 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1,23 +1,27 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/image.h" #include "math/func.h" +#include "common/resources/resourcemanager.h" #include <stdlib.h> #include <stdio.h> @@ -381,7 +385,16 @@ bool CImage::Load(const std::string& fileName) m_error = ""; - m_data->surface = IMG_Load(fileName.c_str()); + SDL_RWops* pointer = CResourceManager::GetSDLFileHandler(fileName.c_str()); + if (pointer == nullptr) + { + delete m_data; + m_data = nullptr; + + m_error = "Unable to open file"; + return false; + } + m_data->surface = IMG_Load_RW(pointer, 1); if (m_data->surface == nullptr) { delete m_data; @@ -458,4 +471,4 @@ void CImage::flipVertically(){ SDL_FreeSurface(m_data->surface); m_data->surface = result; -}
\ No newline at end of file +} diff --git a/src/common/image.h b/src/common/image.h index b93f2f9..e0e270a 100644 --- a/src/common/image.h +++ b/src/common/image.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/image.h diff --git a/src/common/iman.cpp b/src/common/iman.cpp index 88fbb9b..d85c313 100644 --- a/src/common/iman.cpp +++ b/src/common/iman.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/iman.h" @@ -42,9 +45,7 @@ void CInstanceManager::Flush() { for (int i = 0; i < CLASS_MAX; i++) { - if (m_table[i].instances != nullptr) - delete[] m_table[i].instances; - + delete[] m_table[i].instances; m_table[i].instances = nullptr; } } diff --git a/src/common/iman.h b/src/common/iman.h index bfa2204..112ca12 100644 --- a/src/common/iman.h +++ b/src/common/iman.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/iman.h diff --git a/src/common/ioutils.h b/src/common/ioutils.h index 823b720..12c2943 100644 --- a/src/common/ioutils.h +++ b/src/common/ioutils.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/ioutils.h diff --git a/src/common/key.h b/src/common/key.h index 82b3fbd..d4d2a55 100644 --- a/src/common/key.h +++ b/src/common/key.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/key.h diff --git a/src/common/logger.cpp b/src/common/logger.cpp index 7fc8fb0..fd0d418 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/logger.h" diff --git a/src/common/logger.h b/src/common/logger.h index 1a5f3b9..bca0845 100644 --- a/src/common/logger.h +++ b/src/common/logger.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/logger.h diff --git a/src/common/misc.cpp b/src/common/misc.cpp index 92c3e9a..1cbd3b1 100644 --- a/src/common/misc.cpp +++ b/src/common/misc.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/misc.h" diff --git a/src/common/misc.h b/src/common/misc.h index 3c147b1..a079ba6 100644 --- a/src/common/misc.h +++ b/src/common/misc.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #pragma once diff --git a/src/common/profile.cpp b/src/common/profile.cpp index ee3e873..92fc1d6 100644 --- a/src/common/profile.cpp +++ b/src/common/profile.cpp @@ -1,26 +1,32 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/profile.h" -#include "common/logger.h" - +#include "common/resources/inputstream.h" +#include "common/resources/outputstream.h" #include "app/system.h" +#include "common/logger.h" + +#include <memory> #include <utility> #include <cstring> #include <boost/property_tree/ini_parser.hpp> @@ -31,27 +37,51 @@ template<> CProfile* CSingleton<CProfile>::m_instance = nullptr; namespace bp = boost::property_tree; -CProfile::CProfile() : - m_profileNeedSave(false) +CProfile::CProfile() + : m_profileNeedSave(false) + , m_useCurrentDirectory(false) { } CProfile::~CProfile() { - SaveCurrentDirectory(); + Save(); } +void CProfile::SetUseCurrentDirectory(bool useCurrentDirectory) +{ + m_useCurrentDirectory = useCurrentDirectory; +} -bool CProfile::InitCurrentDirectory() +bool CProfile::Init() { try { - #if DEV_BUILD - bp::ini_parser::read_ini("colobot.ini", m_propertyTree); - #else - bp::ini_parser::read_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree); - #endif + std::unique_ptr<std::istream> stream; + bool good; + if (m_useCurrentDirectory) + { + std::ifstream* inputStream = new std::ifstream("./colobot.ini"); + stream = std::unique_ptr<std::istream>(inputStream); + good = inputStream->good(); + } + else + { + CInputStream* inputStream = new CInputStream("colobot.ini"); + stream = std::unique_ptr<std::istream>(inputStream); + good = inputStream->is_open(); + } + + if (good) + { + bp::ini_parser::read_ini(*stream, m_propertyTree); + } + else + { + GetLogger()->Error("Error on parsing profile: failed to open file\n"); + return false; + } } catch (std::exception & e) { @@ -61,17 +91,36 @@ bool CProfile::InitCurrentDirectory() return true; } -bool CProfile::SaveCurrentDirectory() +bool CProfile::Save() { if (m_profileNeedSave) { try { - #if DEV_BUILD - bp::ini_parser::write_ini("colobot.ini", m_propertyTree); - #else - bp::ini_parser::write_ini(GetSystemUtils()->GetProfileFileLocation(), m_propertyTree); - #endif + std::unique_ptr<std::ostream> stream; + bool good; + if (m_useCurrentDirectory) + { + std::ofstream* outputStream = new std::ofstream("./colobot.ini"); + stream = std::unique_ptr<std::ostream>(outputStream); + good = outputStream->good(); + } + else + { + COutputStream* outputStream = new COutputStream("colobot.ini"); + stream = std::unique_ptr<std::ostream>(outputStream); + good = outputStream->is_open(); + } + + if (good) + { + bp::ini_parser::write_ini(*stream, m_propertyTree); + } + else + { + GetLogger()->Error("Error on storing profile: failed to open file\n"); + return false; + } } catch (std::exception & e) { @@ -82,7 +131,7 @@ bool CProfile::SaveCurrentDirectory() return true; } -bool CProfile::SetLocalProfileString(std::string section, std::string key, std::string value) +bool CProfile::SetStringProperty(std::string section, std::string key, std::string value) { try { @@ -98,7 +147,7 @@ bool CProfile::SetLocalProfileString(std::string section, std::string key, std:: } -bool CProfile::GetLocalProfileString(std::string section, std::string key, std::string &buffer) +bool CProfile::GetStringProperty(std::string section, std::string key, std::string &buffer) { try { @@ -113,7 +162,7 @@ bool CProfile::GetLocalProfileString(std::string section, std::string key, std:: } -bool CProfile::SetLocalProfileInt(std::string section, std::string key, int value) +bool CProfile::SetIntProperty(std::string section, std::string key, int value) { try { @@ -129,7 +178,7 @@ bool CProfile::SetLocalProfileInt(std::string section, std::string key, int valu } -bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &value) +bool CProfile::GetIntProperty(std::string section, std::string key, int &value) { try { @@ -144,7 +193,7 @@ bool CProfile::GetLocalProfileInt(std::string section, std::string key, int &val } -bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float value) +bool CProfile::SetFloatProperty(std::string section, std::string key, float value) { try { @@ -160,7 +209,7 @@ bool CProfile::SetLocalProfileFloat(std::string section, std::string key, float } -bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float &value) +bool CProfile::GetFloatProperty(std::string section, std::string key, float &value) { try { @@ -175,7 +224,7 @@ bool CProfile::GetLocalProfileFloat(std::string section, std::string key, float } -std::vector< std::string > CProfile::GetLocalProfileSection(std::string section, std::string key) +std::vector< std::string > CProfile::GetSection(std::string section, std::string key) { std::vector< std::string > ret_list; boost::regex re(key + "[0-9]*"); //we want to match all key followed by any number @@ -205,13 +254,13 @@ void CProfile::SetUserDir(std::string dir) } -std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir) +std::string CProfile::GetUserBasedPath(std::string dir, std::string defaultDir) { std::string path = dir; boost::replace_all(path, "\\", "/"); if (dir.find("/") == std::string::npos) { - path = default_dir + "/" + dir; + path = defaultDir + "/" + dir; } if (m_userDirectory.length() > 0) @@ -220,7 +269,7 @@ std::string CProfile::GetUserBasedPath(std::string dir, std::string default_dir) } else { - boost::replace_all(path, "%user%", default_dir); + boost::replace_all(path, "%user%", defaultDir); } return fs::path(path).make_preferred().string(); diff --git a/src/common/profile.h b/src/common/profile.h index f084ece..444975c 100644 --- a/src/common/profile.h +++ b/src/common/profile.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/profile.h @@ -45,94 +48,98 @@ public: CProfile(); virtual ~CProfile(); + /** Set flag to force using ini file from current directory */ + void SetUseCurrentDirectory(bool useCurrentDirectory); + /** Loads colobot.ini from current directory - * \return return true on success - */ - bool InitCurrentDirectory(); + * \return return true on success + */ + bool Init(); /** Saves colobot.ini to current directory - * \return return true on success - */ - bool SaveCurrentDirectory(); + * \return return true on success + */ + bool Save(); /** Sets string value in section under specified key - * \param section - * \param key - * \param value - * \return return true on success - */ - bool SetLocalProfileString(std::string section, std::string key, std::string value); + * \param section + * \param key + * \param value + * \return return true on success + */ + bool SetStringProperty(std::string section, std::string key, std::string value); /** Gets string value in section under specified key - * \param section - * \param key - * \param buffer - * \return return true on success - */ - bool GetLocalProfileString(std::string section, std::string key, std::string& buffer); + * \param section + * \param key + * \param buffer + * \return return true on success + */ + bool GetStringProperty(std::string section, std::string key, std::string& buffer); /** Sets int value in section under specified key - * \param section - * \param key - * \param value - * \return return true on success - */ - bool SetLocalProfileInt(std::string section, std::string key, int value); + * \param section + * \param key + * \param value + * \return return true on success + */ + bool SetIntProperty(std::string section, std::string key, int value); /** Gets int value in section under specified key - * \param section - * \param key - * \param value - * \return return true on success - */ - bool GetLocalProfileInt(std::string section, std::string key, int &value); + * \param section + * \param key + * \param value + * \return return true on success + */ + bool GetIntProperty(std::string section, std::string key, int &value); /** Sets float value in section under specified key - * \param section - * \param key - * \param value - * \return return true on success - */ - bool SetLocalProfileFloat(std::string section, std::string key, float value); + * \param section + * \param key + * \param value + * \return return true on success + */ + bool SetFloatProperty(std::string section, std::string key, float value); /** Gets float value in section under specified key - * \param section - * \param key - * \param value - * \return return true on success - */ - bool GetLocalProfileFloat(std::string section, std::string key, float &value); + * \param section + * \param key + * \param value + * \return return true on success + */ + bool GetFloatProperty(std::string section, std::string key, float &value); /** Gets all values in section under specified key - * \param section - * \param key - * \return vector of values - */ - std::vector< std::string > GetLocalProfileSection(std::string section, std::string key); + * \param section + * \param key + * \return vector of values + */ + std::vector< std::string > GetSection(std::string section, std::string key); /** Sets current user directory - * \param dir - */ + * \param dir + */ void SetUserDir(std::string dir); /** Returns path based on current user. Replaces %user% in path with current user dir or - * uses default_dir param if no user dir is specified - * \param dir - * \param default_dir - * \return path - */ - std::string GetUserBasedPath(std::string dir, std::string default_dir); - - /** opy a file into the temporary folder. - * \param filename - * \return true on success - */ + * uses default_dir param if no user dir is specified + * \param dir + * \param default_dir + * \return path + */ + std::string GetUserBasedPath(std::string dir, std::string defaultDir); + + /** Copy a file into the temporary folder. + * \param filename + * \return true on success + */ bool CopyFileToTemp(std::string filename); private: boost::property_tree::ptree m_propertyTree; bool m_profileNeedSave; std::string m_userDirectory; + bool m_useCurrentDirectory; }; //! Global function to get profile instance diff --git a/src/common/resources/inputstream.cpp b/src/common/resources/inputstream.cpp new file mode 100644 index 0000000..57d1305 --- /dev/null +++ b/src/common/resources/inputstream.cpp @@ -0,0 +1,61 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "common/resources/inputstream.h" +#include "common/resources/inputstreambuffer.h" + + +CInputStream::CInputStream() : std::istream(new CInputStreamBuffer()) +{ +} + +CInputStream::CInputStream(const std::string& filename) : std::istream(new CInputStreamBuffer()) +{ + open(filename); +} + + +CInputStream::~CInputStream() +{ + delete rdbuf(); +} + + +void CInputStream::open(const std::string& filename) +{ + static_cast<CInputStreamBuffer *>(rdbuf())->open(filename); +} + + +void CInputStream::close() +{ + static_cast<CInputStreamBuffer *>(rdbuf())->close(); +} + + +bool CInputStream::is_open() +{ + return static_cast<CInputStreamBuffer *>(rdbuf())->is_open(); +} + + +size_t CInputStream::size() +{ + return static_cast<CInputStreamBuffer *>(rdbuf())->size(); +} diff --git a/src/common/resources/inputstream.h b/src/common/resources/inputstream.h new file mode 100644 index 0000000..74e17b2 --- /dev/null +++ b/src/common/resources/inputstream.h @@ -0,0 +1,37 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <istream> +#include <string> + + +class CInputStream : public std::istream +{ +public: + CInputStream(); + CInputStream(const std::string& filename); + virtual ~CInputStream(); + + void open(const std::string& filename); + void close(); + bool is_open(); + size_t size(); +}; diff --git a/src/common/resources/inputstreambuffer.cpp b/src/common/resources/inputstreambuffer.cpp new file mode 100644 index 0000000..7059d60 --- /dev/null +++ b/src/common/resources/inputstreambuffer.cpp @@ -0,0 +1,132 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "common/resources/inputstreambuffer.h" + +#include <stdexcept> +#include <sstream> + +CInputStreamBuffer::CInputStreamBuffer(size_t buffer_size) : m_buffer_size(buffer_size) +{ + if (buffer_size <= 0) + { + throw std::runtime_error("File buffer must be larger then 0 bytes"); + } + + m_buffer = new char[buffer_size]; + m_file = nullptr; +} + + +CInputStreamBuffer::~CInputStreamBuffer() +{ + close(); + delete m_buffer; +} + + +void CInputStreamBuffer::open(const std::string &filename) +{ + if (PHYSFS_isInit()) + m_file = PHYSFS_openRead(filename.c_str()); +} + + +void CInputStreamBuffer::close() +{ + if (is_open()) + PHYSFS_close(m_file); +} + + +bool CInputStreamBuffer::is_open() +{ + return m_file; +} + + +size_t CInputStreamBuffer::size() +{ + return PHYSFS_fileLength(m_file); +} + + +std::streambuf::int_type CInputStreamBuffer::underflow() +{ + if (gptr() < egptr()) + return traits_type::to_int_type(*gptr()); + + if (PHYSFS_eof(m_file)) + return traits_type::eof(); + + PHYSFS_sint64 read_count = PHYSFS_read(m_file, m_buffer, sizeof(char), m_buffer_size); + if (read_count <= 0) + return traits_type::eof(); + + setg(m_buffer, m_buffer, m_buffer + read_count); + + return traits_type::to_int_type(*gptr()); +} + + +std::streampos CInputStreamBuffer::seekpos(std::streampos sp, std::ios_base::openmode which) +{ + return seekoff(off_type(sp), std::ios_base::beg, which); +} + + +std::streampos CInputStreamBuffer::seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which) +{ + /* A bit of explanation: + We are reading file by m_buffer_size parts so our 3 internal pointers will be + * eback (not used here) - start of block + * gptr - position of read cursor in block + * egtpr - end of block + off argument is relative to way */ + + std::streamoff new_position; + + switch (way) + { + case std::ios_base::beg: + new_position = off; + break; + + case std::ios_base::cur: + // tell will give cursor at begining of block so we have to add where in block we currently are + new_position = off + static_cast<off_type>(PHYSFS_tell(m_file)) - static_cast<off_type> (egptr() - gptr()); + break; + + case std::ios_base::end: + new_position = off + static_cast<off_type>(PHYSFS_fileLength(m_file)); + break; + + default: + break; + } + + if (PHYSFS_seek(m_file, new_position)) + { + setg(m_buffer, m_buffer, m_buffer); // reset buffer + + return pos_type(new_position); + } + + return pos_type(off_type(-1)); +} diff --git a/src/common/resources/inputstreambuffer.h b/src/common/resources/inputstreambuffer.h new file mode 100644 index 0000000..8c45c22 --- /dev/null +++ b/src/common/resources/inputstreambuffer.h @@ -0,0 +1,51 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <streambuf> +#include <string> +#include <physfs.h> + +class CInputStreamBuffer : public std::streambuf +{ +public: + CInputStreamBuffer(size_t buffer_size = 512); + virtual ~CInputStreamBuffer(); + + void open(const std::string &filename); + void close(); + bool is_open(); + size_t size(); + +private: + int_type underflow(); + + std::streampos seekpos(std::streampos sp, std::ios_base::openmode which); + std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which); + + // copy ctor and assignment not implemented; + // copying not allowed + CInputStreamBuffer(const CInputStreamBuffer &); + CInputStreamBuffer &operator= (const CInputStreamBuffer &); + + PHYSFS_File *m_file; + char *m_buffer; + size_t m_buffer_size; +}; diff --git a/src/common/resources/outputstream.cpp b/src/common/resources/outputstream.cpp new file mode 100644 index 0000000..e88520e --- /dev/null +++ b/src/common/resources/outputstream.cpp @@ -0,0 +1,55 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "common/resources/outputstream.h" +#include "common/resources/outputstreambuffer.h" + + +COutputStream::COutputStream() : std::ostream(new COutputStreamBuffer()) +{ +} + +COutputStream::COutputStream(const std::string& filename) : std::ostream(new COutputStreamBuffer()) +{ + open(filename); +} + + +COutputStream::~COutputStream() +{ + delete rdbuf(); +} + + +void COutputStream::open(const std::string& filename) +{ + static_cast<COutputStreamBuffer *>(rdbuf())->open(filename); +} + + +void COutputStream::close() +{ + static_cast<COutputStreamBuffer *>(rdbuf())->close(); +} + + +bool COutputStream::is_open() +{ + return static_cast<COutputStreamBuffer *>(rdbuf())->is_open(); +} diff --git a/src/common/resources/outputstream.h b/src/common/resources/outputstream.h new file mode 100644 index 0000000..30b9429 --- /dev/null +++ b/src/common/resources/outputstream.h @@ -0,0 +1,36 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <ostream> +#include <string> + + +class COutputStream : public std::ostream +{ +public: + COutputStream(); + COutputStream(const std::string& filename); + virtual ~COutputStream(); + + void open(const std::string& filename); + void close(); + bool is_open(); +}; diff --git a/src/common/resources/outputstreambuffer.cpp b/src/common/resources/outputstreambuffer.cpp new file mode 100644 index 0000000..f8b4100 --- /dev/null +++ b/src/common/resources/outputstreambuffer.cpp @@ -0,0 +1,89 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "common/resources/outputstreambuffer.h" + +#include <stdexcept> +#include <sstream> + +COutputStreamBuffer::COutputStreamBuffer(size_t buffer_size) : m_buffer_size(buffer_size) +{ + m_file = nullptr; + m_buffer = new char[buffer_size]; + setp(m_buffer, m_buffer + buffer_size); +} + + +COutputStreamBuffer::~COutputStreamBuffer() +{ + close(); + delete m_buffer; +} + + +void COutputStreamBuffer::open(const std::string &filename) +{ + if (PHYSFS_isInit()) + m_file = PHYSFS_openWrite(filename.c_str()); +} + + +void COutputStreamBuffer::close() +{ + sync(); + if (is_open()) + PHYSFS_close(m_file); +} + + +bool COutputStreamBuffer::is_open() +{ + return m_file; +} + + +std::streambuf::int_type COutputStreamBuffer::overflow(std::streambuf::int_type ch) +{ + /* This function should be called when pptr() == epptr(). We use it also in sync() + so we also have to write data if buffer is not full. */ + + if (pbase() == pptr()) // no data to write, sync() called with empty buffer + return 0; + + // save buffer + PHYSFS_sint64 bytes_written = PHYSFS_write(m_file, pbase(), 1, pptr() - pbase()); + if (bytes_written <= 0) + return traits_type::eof(); + + pbump(-bytes_written); + // write final char + if (ch != traits_type::eof()) { + bytes_written = PHYSFS_write(m_file, &ch, 1, 1); + if (bytes_written <= 0) + return traits_type::eof(); + } + + return ch; +} + + +int COutputStreamBuffer::sync() +{ + return overflow(traits_type::eof()); +} diff --git a/src/common/resources/outputstreambuffer.h b/src/common/resources/outputstreambuffer.h new file mode 100644 index 0000000..758c4df --- /dev/null +++ b/src/common/resources/outputstreambuffer.h @@ -0,0 +1,46 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <streambuf> +#include <string> +#include <physfs.h> + +class COutputStreamBuffer : public std::streambuf +{ +public: + COutputStreamBuffer(size_t buffer_size = 512); + virtual ~COutputStreamBuffer(); + void open(const std::string &filename); + void close(); + bool is_open(); + +private: + int_type overflow(int_type ch); + int sync(); + + // copy ctor and assignment not implemented; + // copying not allowed + COutputStreamBuffer(const COutputStreamBuffer &); + COutputStreamBuffer &operator= (const COutputStreamBuffer &); + PHYSFS_File *m_file; + char *m_buffer; + size_t m_buffer_size; +}; diff --git a/src/common/resources/resourcemanager.cpp b/src/common/resources/resourcemanager.cpp new file mode 100644 index 0000000..42f9634 --- /dev/null +++ b/src/common/resources/resourcemanager.cpp @@ -0,0 +1,288 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + + +#include "common/resources/resourcemanager.h" + +#include "common/config.h" +#include "common/logger.h" + +#include <physfs.h> + +#include <boost/filesystem.hpp> + +namespace fs = boost::filesystem; + +namespace +{ + const Uint32 PHYSFS_RWOPS_TYPE = 0xc010b04f; +} + + +CResourceManager::CResourceManager(const char *argv0) +{ + if (!PHYSFS_init(argv0)) + { + CLogger::GetInstancePointer()->Error("Error while initializing physfs\n"); + } +} + + +CResourceManager::~CResourceManager() +{ + if (PHYSFS_isInit()) + { + if (!PHYSFS_deinit()) + { + CLogger::GetInstancePointer()->Error("Error while deinitializing physfs\n"); + } + } +} + + +bool CResourceManager::AddLocation(const std::string &location, bool prepend) +{ + if (PHYSFS_isInit()) + { + if (!PHYSFS_mount(location.c_str(), nullptr, prepend ? 0 : 1)) + { + CLogger::GetInstancePointer()->Error("Error while mounting \"%s\"\n", location.c_str()); + } + } + + return false; +} + + +bool CResourceManager::RemoveLocation(const std::string &location) +{ + if (PHYSFS_isInit()) + { + if (!PHYSFS_removeFromSearchPath(location.c_str())) + { + CLogger::GetInstancePointer()->Error("Error while unmounting \"%s\"\n", location.c_str()); + } + } + + return false; +} + + +bool CResourceManager::SetSaveLocation(const std::string &location) +{ + if (PHYSFS_isInit()) + { + if (!PHYSFS_setWriteDir(location.c_str())) + { + CLogger::GetInstancePointer()->Error("Error while setting save location to \"%s\"\n", location.c_str()); + } + } + + return false; +} + +std::string CResourceManager::GetSaveLocation() +{ + if(PHYSFS_isInit()) { + return PHYSFS_getWriteDir(); + } + return ""; +} + + +SDL_RWops* CResourceManager::GetSDLFileHandler(const std::string &filename) +{ + SDL_RWops *handler = SDL_AllocRW(); + if (!handler) + { + CLogger::GetInstancePointer()->Error("Unable to allocate SDL_RWops for \"%s\"\n", filename.c_str()); + return nullptr; + } + + if (!PHYSFS_isInit()) + { + SDL_FreeRW(handler); + return nullptr; + } + + PHYSFS_File *file = PHYSFS_openRead(filename.c_str()); + if (!file) + { + SDL_FreeRW(handler); + return nullptr; + } + + handler->seek = SDLSeek; + handler->read = SDLRead; + handler->write = SDLWrite; + handler->close = SDLClose; + handler->type = PHYSFS_RWOPS_TYPE; + handler->hidden.unknown.data1 = file; + + return handler; +} + + +CSNDFile* CResourceManager::GetSNDFileHandler(const std::string &filename) +{ + return new CSNDFile(filename); +} + + +bool CResourceManager::Exists(const std::string &filename) +{ + return PHYSFS_exists(filename.c_str()); +} + +bool CResourceManager::DirectoryExists(const std::string& directory) +{ + return PHYSFS_exists(directory.c_str()) && PHYSFS_isDirectory(directory.c_str()); +} + +bool CResourceManager::CreateDirectory(const std::string& directory) +{ + return PHYSFS_mkdir(directory.c_str()); +} + +bool CResourceManager::RemoveDirectory(const std::string& directory) +{ + bool success = true; + std::string writeDir = PHYSFS_getWriteDir(); + try + { + fs::remove_all(writeDir + "/" + directory); + } + catch (std::exception & e) + { + success = false; + } + return success; +} + +std::vector<std::string> CResourceManager::ListFiles(const std::string &directory) +{ + std::vector<std::string> result; + + char **files = PHYSFS_enumerateFiles(directory.c_str()); + + for (char **i = files; *i != nullptr; i++) + { + result.push_back(*i); + } + + PHYSFS_freeList(files); + + return result; +} + +std::vector<std::string> CResourceManager::ListDirectories(const std::string &directory) +{ + std::vector<std::string> result; + + char **files = PHYSFS_enumerateFiles(directory.c_str()); + + for (char **i = files; *i != nullptr; i++) + { + std::string path = directory + "/" + (*i); + if (PHYSFS_isDirectory(path.c_str())) + { + result.push_back(*i); + } + } + + PHYSFS_freeList(files); + + return result; +} + + +int CResourceManager::SDLClose(SDL_RWops *context) +{ + if (CheckSDLContext(context)) + { + PHYSFS_close(static_cast<PHYSFS_File *>(context->hidden.unknown.data1)); + SDL_FreeRW(context); + + return 0; + } + + return 1; +} + + +int CResourceManager::SDLRead(SDL_RWops *context, void *ptr, int size, int maxnum) +{ + if (CheckSDLContext(context)) + { + PHYSFS_File *file = static_cast<PHYSFS_File *>(context->hidden.unknown.data1); + SDL_memset(ptr, 0, size * maxnum); + + return PHYSFS_read(file, ptr, size, maxnum); + } + + return 0; +} + + +int CResourceManager::SDLWrite(SDL_RWops *context, const void *ptr, int size, int num) +{ + return 0; +} + + +int CResourceManager::SDLSeek(SDL_RWops *context, int offset, int whence) +{ + if (CheckSDLContext(context)) + { + PHYSFS_File *file = static_cast<PHYSFS_File *>(context->hidden.unknown.data1); + int position, result; + + switch (whence) + { + default: + case RW_SEEK_SET: + result = PHYSFS_seek(file, offset); + return result > 0 ? offset : -1; + + case RW_SEEK_CUR: + position = offset + PHYSFS_tell(file); + result = PHYSFS_seek(file, position); + return result > 0 ? position : -1; + + case RW_SEEK_END: + position = PHYSFS_fileLength(file) - offset; + result = PHYSFS_seek(file, position); + return result > 0 ? position : -1; + } + } + + return -1; +} + + +bool CResourceManager::CheckSDLContext(SDL_RWops *context) +{ + if (context->type != PHYSFS_RWOPS_TYPE) + { + SDL_SetError("Wrong kind of RWops"); + return false; + } + + return true; +} diff --git a/src/common/resources/resourcemanager.h b/src/common/resources/resourcemanager.h new file mode 100644 index 0000000..730cf3e --- /dev/null +++ b/src/common/resources/resourcemanager.h @@ -0,0 +1,64 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <vector> +#include <string> +#include <SDL.h> + +#include "common/resources/sndfile.h" + +class CResourceManager +{ +public: + CResourceManager(const char *argv0); + ~CResourceManager(); + + static bool AddLocation(const std::string &location, bool prepend = true); + static bool RemoveLocation(const std::string &location); + + static bool SetSaveLocation(const std::string &location); + static std::string GetSaveLocation(); + + static SDL_RWops* GetSDLFileHandler(const std::string &filename); + static CSNDFile* GetSNDFileHandler(const std::string &filename); + + //! Check if file exists + static bool Exists(const std::string &filename); + //! Check if file exists and is a directory + static bool DirectoryExists(const std::string& directory); + + //! Create directory in write directory + static bool CreateDirectory(const std::string& directory); + //! Remove directory in write directory, recursively + static bool RemoveDirectory(const std::string& directory); + + //! List files contained in directory + static std::vector<std::string> ListFiles(const std::string &directory); + //! List directories contained in directory + static std::vector<std::string> ListDirectories(const std::string &directory); + +private: + static int SDLSeek(SDL_RWops *context, int offset, int whence); + static int SDLRead(SDL_RWops *context, void *ptr, int size, int maxnum); + static int SDLWrite(SDL_RWops *context, const void *ptr, int size, int num); + static int SDLClose(SDL_RWops *context); + static bool CheckSDLContext(SDL_RWops *context); +}; diff --git a/src/common/resources/sndfile.cpp b/src/common/resources/sndfile.cpp new file mode 100644 index 0000000..d2330e1 --- /dev/null +++ b/src/common/resources/sndfile.cpp @@ -0,0 +1,133 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "common/resources/sndfile.h" + +#include <cstring> + + +CSNDFile::CSNDFile(const std::string& filename) + : m_file_info{} + , m_snd_file{nullptr} + , m_file{nullptr} + , m_last_error{} + , m_snd_callbacks{SNDLength, SNDSeek, SNDRead, SNDWrite, SNDTell} +{ + if (PHYSFS_isInit()) + { + m_file = PHYSFS_openRead(filename.c_str()); + } + else + { + m_last_error = "Resource system not started!"; + } + if (m_file) + { + m_snd_file = sf_open_virtual(&m_snd_callbacks, SFM_READ, &m_file_info, m_file); + if (!m_snd_file) + { + m_last_error = "Could not load file"; + } + } + else + { + m_last_error = std::string(PHYSFS_getLastError()); + } +} + + +CSNDFile::~CSNDFile() +{ + if (m_file) + { + PHYSFS_close(m_file); + if (m_snd_file) + { + sf_close(m_snd_file); + } + } +} + + +bool CSNDFile::IsOpen() +{ + return m_file && m_snd_file; +} + + +SF_INFO &CSNDFile::GetFileInfo() +{ + return m_file_info; +} + + +std::string& CSNDFile::GetLastError() +{ + return m_last_error; +} + + +sf_count_t CSNDFile::Read(short int *ptr, sf_count_t items) +{ + return sf_read_short(m_snd_file, ptr, items); +} + + +sf_count_t CSNDFile::SNDLength(void *data) +{ + return PHYSFS_fileLength(static_cast<PHYSFS_File *>(data)); +} + + +sf_count_t CSNDFile::SNDRead(void *ptr, sf_count_t count, void *data) +{ + return PHYSFS_read(static_cast<PHYSFS_File *>(data), ptr, 1, count); +} + + +sf_count_t CSNDFile::SNDSeek(sf_count_t offset, int whence, void *data) +{ + PHYSFS_File *file = static_cast<PHYSFS_File *>(data); + switch(whence) + { + case SEEK_CUR: + PHYSFS_seek(file, PHYSFS_tell(file) + offset); + break; + case SEEK_SET: + PHYSFS_seek(file, offset); + break; + case SEEK_END: + PHYSFS_seek(file, PHYSFS_fileLength(file) + offset); + break; + } + + return PHYSFS_tell(file); +} + + +sf_count_t CSNDFile::SNDTell(void *data) +{ + return PHYSFS_tell(static_cast<PHYSFS_File *>(data)); +} + + +sf_count_t CSNDFile::SNDWrite(const void *ptr, sf_count_t count, void *data) +{ + return PHYSFS_write(static_cast<PHYSFS_File *>(data), ptr, 1, count); +} diff --git a/src/common/resources/sndfile.h b/src/common/resources/sndfile.h new file mode 100644 index 0000000..f083666 --- /dev/null +++ b/src/common/resources/sndfile.h @@ -0,0 +1,49 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#pragma once + +#include <string> +#include <physfs.h> +#include <sndfile.h> + + +class CSNDFile +{ +public: + CSNDFile(const std::string &filename); + virtual ~CSNDFile(); + + SF_INFO &GetFileInfo(); + bool IsOpen(); + std::string &GetLastError(); + sf_count_t Read(short int *ptr, sf_count_t items); + +private: + static sf_count_t SNDLength(void *data); + static sf_count_t SNDSeek(sf_count_t offset, int whence, void *data); + static sf_count_t SNDRead(void *ptr, sf_count_t count, void *data); + static sf_count_t SNDWrite(const void *ptr, sf_count_t count, void *data); + static sf_count_t SNDTell(void *data); + SF_INFO m_file_info; + SNDFILE *m_snd_file; + PHYSFS_File *m_file; + std::string m_last_error; + SF_VIRTUAL_IO m_snd_callbacks; +}; diff --git a/src/common/restext.cpp b/src/common/restext.cpp index bc488b8..95e015c 100644 --- a/src/common/restext.cpp +++ b/src/common/restext.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/restext.h" @@ -38,694 +41,697 @@ const char* stringsObject[OBJECT_MAX] = { nullptr }; const char* stringsErr[ERR_MAX] = { nullptr }; const char* stringsCbot[TX_MAX] = { nullptr }; +/* Macro to mark which texts are translatable by gettext + * It doesn't do anything at compile-time, as all texts represented here are used later + * in explicit call to gettext(), but it is used by xgettext executable to filter extracted + * texts from this file. + */ +#define TR(x) x + void InitializeRestext() { stringsText[RT_VERSION_ID] = COLOBOT_FULLNAME; - stringsText[RT_DISINFO_TITLE] = "SatCom"; - stringsText[RT_WINDOW_MAXIMIZED] = "Maximize"; - stringsText[RT_WINDOW_MINIMIZED] = "Minimize"; - stringsText[RT_WINDOW_STANDARD] = "Normal size"; - stringsText[RT_WINDOW_CLOSE] = "Close"; - - stringsText[RT_STUDIO_TITLE] = "Program editor"; - stringsText[RT_SCRIPT_NEW] = "New"; - stringsText[RT_NAME_DEFAULT] = "Player"; - stringsText[RT_IO_NEW] = "New ..."; - stringsText[RT_KEY_OR] = " or "; - - stringsText[RT_TITLE_BASE] = "COLOBOT"; - stringsText[RT_TITLE_INIT] = "COLOBOT: Gold Edition"; - stringsText[RT_TITLE_TRAINER] = "Programming exercises"; - stringsText[RT_TITLE_DEFI] = "Challenges"; - stringsText[RT_TITLE_MISSION] = "Missions"; - stringsText[RT_TITLE_FREE] = "Free game"; - stringsText[RT_TITLE_TEEN] = "Free game"; - stringsText[RT_TITLE_USER] = "User levels"; - stringsText[RT_TITLE_SETUP] = "Options"; - stringsText[RT_TITLE_NAME] = "Player's name"; - stringsText[RT_TITLE_PERSO] = "Customize your appearance"; - stringsText[RT_TITLE_WRITE] = "Save the current mission"; - stringsText[RT_TITLE_READ] = "Load a saved mission"; - - stringsText[RT_PLAY_CHAPt] = " Chapters:"; - stringsText[RT_PLAY_CHAPd] = " Chapters:"; - stringsText[RT_PLAY_CHAPm] = " Planets:"; - stringsText[RT_PLAY_CHAPf] = " Planets:"; - stringsText[RT_PLAY_CHAPu] = " User levels:"; - stringsText[RT_PLAY_CHAPte] = " Chapters:"; - stringsText[RT_PLAY_LISTt] = " Exercises in the chapter:"; - stringsText[RT_PLAY_LISTd] = " Challenges in the chapter:"; - stringsText[RT_PLAY_LISTm] = " Missions on this planet:"; - stringsText[RT_PLAY_LISTf] = " Free game on this planet:"; - stringsText[RT_PLAY_LISTu] = " Missions on this level:"; - stringsText[RT_PLAY_LISTk] = " Free game on this chapter:"; - stringsText[RT_PLAY_RESUME] = " Summary:"; - - stringsText[RT_SETUP_DEVICE] = " Drivers:"; - stringsText[RT_SETUP_MODE] = " Resolution:"; - stringsText[RT_SETUP_KEY1] = "1) First click on the key you want to redefine."; - stringsText[RT_SETUP_KEY2] = "2) Then press the key you want to use instead."; - - stringsText[RT_PERSO_FACE] = "Face type:"; - stringsText[RT_PERSO_GLASSES] = "Eyeglasses:"; - stringsText[RT_PERSO_HAIR] = "Hair color:"; - stringsText[RT_PERSO_COMBI] = "Suit color:"; - stringsText[RT_PERSO_BAND] = "Strip color:"; - - stringsText[RT_DIALOG_QUIT] = "Do you want to quit COLOBOT ?"; - stringsText[RT_DIALOG_TITLE] = "COLOBOT"; - stringsText[RT_DIALOG_YESQUIT] = "Quit\\Quit COLOBOT"; - stringsText[RT_DIALOG_ABORT] = "Quit the mission?"; - stringsText[RT_DIALOG_YES] = "Abort\\Abort the current mission"; - stringsText[RT_DIALOG_NO] = "Continue\\Continue the current mission"; - stringsText[RT_DIALOG_NOQUIT] = "Continue\\Continue the game"; - stringsText[RT_DIALOG_DELOBJ] = "Do you really want to destroy the selected building?"; - stringsText[RT_DIALOG_DELGAME] = "Do you want to delete %s's saved games? "; - stringsText[RT_DIALOG_YESDEL] = "Delete"; - stringsText[RT_DIALOG_NODEL] = "Cancel"; - stringsText[RT_DIALOG_LOADING] = "LOADING"; - - stringsText[RT_STUDIO_LISTTT] = "Keyword help(\\key cbot;)"; - stringsText[RT_STUDIO_COMPOK] = "Compilation ok (0 errors)"; - stringsText[RT_STUDIO_PROGSTOP] = "Program finished"; - - stringsText[RT_SATCOM_LIST] = "\\b;List of objects\n"; - stringsText[RT_SATCOM_BOT] = "\\b;Robots\n"; - stringsText[RT_SATCOM_BUILDING] = "\\b;Buildings\n"; - stringsText[RT_SATCOM_FRET] = "\\b;Moveable objects\n"; - stringsText[RT_SATCOM_ALIEN] = "\\b;Aliens\n"; - stringsText[RT_SATCOM_NULL] = "\\c; (none)\\n;\n"; - stringsText[RT_SATCOM_ERROR1] = "\\b;Error\n"; - stringsText[RT_SATCOM_ERROR2] = "The list is only available if a \\l;radar station\\u object\\radar; is working.\n"; - - stringsText[RT_IO_OPEN] = "Open"; - stringsText[RT_IO_SAVE] = "Save"; - stringsText[RT_IO_LIST] = "Folder: %s"; - stringsText[RT_IO_NAME] = "Name:"; - stringsText[RT_IO_DIR] = "Folder:"; - stringsText[RT_IO_PRIVATE] = "Private\\Private folder"; - stringsText[RT_IO_PUBLIC] = "Public\\Common folder"; - - stringsText[RT_GENERIC_DEV1] = "Developed by :"; - stringsText[RT_GENERIC_DEV2] = "www.epsitec.com"; - stringsText[RT_GENERIC_EDIT1] = " "; - stringsText[RT_GENERIC_EDIT2] = " "; - - stringsText[RT_INTERFACE_REC] = "Recorder"; - - - - stringsEvent[EVENT_BUTTON_OK] = "OK"; - stringsEvent[EVENT_BUTTON_CANCEL] = "Cancel"; - stringsEvent[EVENT_BUTTON_NEXT] = "Next"; - stringsEvent[EVENT_BUTTON_PREV] = "Previous"; - stringsEvent[EVENT_BUTTON_QUIT] = "Menu (\\key quit;)"; - - stringsEvent[EVENT_DIALOG_OK] = "OK"; - stringsEvent[EVENT_DIALOG_CANCEL] = "Cancel"; - - stringsEvent[EVENT_INTERFACE_TRAINER] = "Exercises\\Programming exercises"; - stringsEvent[EVENT_INTERFACE_DEFI] = "Challenges\\Programming challenges"; - stringsEvent[EVENT_INTERFACE_MISSION] = "Missions\\Select mission"; - stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal"; - stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal"; - stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels"; - stringsEvent[EVENT_INTERFACE_NAME] = "Change player\\Change player"; - stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences"; - stringsEvent[EVENT_INTERFACE_AGAIN] = "Restart\\Restart the mission from the beginning"; - stringsEvent[EVENT_INTERFACE_WRITE] = "Save\\Save the current mission "; - stringsEvent[EVENT_INTERFACE_READ] = "Load\\Load a saved mission"; - stringsEvent[EVENT_INTERFACE_ABORT] = "\\Return to COLOBOT"; - stringsEvent[EVENT_INTERFACE_QUIT] = "Quit\\Quit COLOBOT"; - stringsEvent[EVENT_INTERFACE_BACK] = "<< Back \\Back to the previous screen"; - stringsEvent[EVENT_INTERFACE_PLAY] = "Play\\Start mission!"; - stringsEvent[EVENT_INTERFACE_SETUPd] = "Device\\Driver and resolution settings"; - stringsEvent[EVENT_INTERFACE_SETUPg] = "Graphics\\Graphics settings"; - stringsEvent[EVENT_INTERFACE_SETUPp] = "Game\\Game settings"; - stringsEvent[EVENT_INTERFACE_SETUPc] = "Controls\\Keyboard, joystick and mouse settings"; - stringsEvent[EVENT_INTERFACE_SETUPs] = "Sound\\Music and game sound volume"; - stringsEvent[EVENT_INTERFACE_DEVICE] = "Unit"; - stringsEvent[EVENT_INTERFACE_RESOL] = "Resolution"; - stringsEvent[EVENT_INTERFACE_FULL] = "Full screen\\Full screen or window mode"; - stringsEvent[EVENT_INTERFACE_APPLY] = "Apply changes\\Activates the changed settings"; - - stringsEvent[EVENT_INTERFACE_TOTO] = "Robbie\\Your assistant"; - stringsEvent[EVENT_INTERFACE_SHADOW] = "Shadows\\Shadows on the ground"; - stringsEvent[EVENT_INTERFACE_GROUND] = "Marks on the ground\\Marks on the ground"; - stringsEvent[EVENT_INTERFACE_DIRTY] = "Dust\\Dust and dirt on bots and buildings"; - stringsEvent[EVENT_INTERFACE_FOG] = "Fog\\Fog"; - stringsEvent[EVENT_INTERFACE_LENS] = "Sunbeams\\Sunbeams in the sky"; - stringsEvent[EVENT_INTERFACE_SKY] = "Sky\\Clouds and nebulae"; - stringsEvent[EVENT_INTERFACE_PLANET] = "Planets and stars\\Astronomical objects in the sky"; - stringsEvent[EVENT_INTERFACE_LIGHT] = "Dynamic lighting\\Mobile light sources"; - stringsEvent[EVENT_INTERFACE_PARTI] = "Number of particles\\Explosions, dust, reflections, etc."; - stringsEvent[EVENT_INTERFACE_CLIP] = "Depth of field\\Maximum visibility"; - stringsEvent[EVENT_INTERFACE_DETAIL] = "Details\\Visual quality of 3D objects"; - stringsEvent[EVENT_INTERFACE_TEXTURE] = "Textures\\Quality of textures "; - stringsEvent[EVENT_INTERFACE_GADGET] = "Num of decorative objects\\Number of purely ornamental objects"; - stringsEvent[EVENT_INTERFACE_RAIN] = "Particles in the interface\\Steam clouds and sparks in the interface"; - stringsEvent[EVENT_INTERFACE_GLINT] = "Reflections on the buttons \\Shiny buttons"; - stringsEvent[EVENT_INTERFACE_TOOLTIP] = "Help balloons\\Explain the function of the buttons"; - stringsEvent[EVENT_INTERFACE_MOVIES] = "Film sequences\\Films before and after the missions"; - stringsEvent[EVENT_INTERFACE_NICERST] = "Exit film\\Film at the exit of exercises"; - stringsEvent[EVENT_INTERFACE_HIMSELF] = "Friendly fire\\Your shooting can damage your own objects "; - stringsEvent[EVENT_INTERFACE_SCROLL] = "Scrolling\\Scrolling when the mouse touches right or left border"; - stringsEvent[EVENT_INTERFACE_INVERTX] = "Mouse inversion X\\Inversion of the scrolling direction on the X axis"; - stringsEvent[EVENT_INTERFACE_INVERTY] = "Mouse inversion Y\\Inversion of the scrolling direction on the Y axis"; - stringsEvent[EVENT_INTERFACE_EFFECT] = "Quake at explosions\\The screen shakes at explosions"; - stringsEvent[EVENT_INTERFACE_MOUSE] = "Mouse shadow\\Gives the mouse a shadow"; - stringsEvent[EVENT_INTERFACE_EDITMODE] = "Automatic indent\\When program editing"; - stringsEvent[EVENT_INTERFACE_EDITVALUE] = "Big indent\\Indent 2 or 4 spaces per level defined by braces"; - stringsEvent[EVENT_INTERFACE_SOLUCE4] = "Access to solutions\\Show program \"4: Solution\" in the exercises"; - stringsEvent[EVENT_INTERFACE_BLOOD] = "Blood\\Display blood when the astronaut or the alien queen is hit"; - - stringsEvent[EVENT_INTERFACE_KDEF] = "Standard controls\\Standard key functions"; - stringsEvent[EVENT_INTERFACE_KLEFT] = "Turn left\\turns the bot to the left"; - stringsEvent[EVENT_INTERFACE_KRIGHT] = "Turn right\\turns the bot to the right"; - stringsEvent[EVENT_INTERFACE_KUP] = "Forward\\Moves forward"; - stringsEvent[EVENT_INTERFACE_KDOWN] = "Backward\\Moves backward"; - stringsEvent[EVENT_INTERFACE_KGUP] = "Climb\\Increases the power of the jet"; - stringsEvent[EVENT_INTERFACE_KGDOWN] = "Descend\\Reduces the power of the jet"; - stringsEvent[EVENT_INTERFACE_KCAMERA] = "Change camera\\Switches between onboard camera and following camera"; - stringsEvent[EVENT_INTERFACE_KDESEL] = "Previous object\\Selects the previous object"; - stringsEvent[EVENT_INTERFACE_KACTION] = "Standard action\\Standard action of the bot (take/grab, shoot, sniff, etc)"; - stringsEvent[EVENT_INTERFACE_KNEAR] = "Camera closer\\Moves the camera forward"; - stringsEvent[EVENT_INTERFACE_KAWAY] = "Camera back\\Moves the camera backward"; - stringsEvent[EVENT_INTERFACE_KNEXT] = "Next object\\Selects the next object"; - stringsEvent[EVENT_INTERFACE_KHUMAN] = "Select the astronaut\\Selects the astronaut"; - stringsEvent[EVENT_INTERFACE_KQUIT] = "Quit\\Quit the current mission or exercise"; - stringsEvent[EVENT_INTERFACE_KHELP] = "Instructions\\Shows the instructions for the current mission"; - stringsEvent[EVENT_INTERFACE_KPROG] = "Programming help\\Gives more detailed help with programming"; - stringsEvent[EVENT_INTERFACE_KCBOT] = "Key word help\\More detailed help about key words"; - stringsEvent[EVENT_INTERFACE_KVISIT] = "Origin of last message\\Shows where the last message was sent from"; - stringsEvent[EVENT_INTERFACE_KSPEED10] = "Speed 1.0x\\Normal speed"; - stringsEvent[EVENT_INTERFACE_KSPEED15] = "Speed 1.5x\\1.5 times faster"; - stringsEvent[EVENT_INTERFACE_KSPEED20] = "Speed 2.0x\\Double speed"; - stringsEvent[EVENT_INTERFACE_KSPEED30] = "Speed 3.0x\\Three times faster"; - - stringsEvent[EVENT_INTERFACE_VOLSOUND] = "Sound effects:\\Volume of engines, voice, shooting, etc."; - stringsEvent[EVENT_INTERFACE_VOLMUSIC] = "Background sound :\\Volume of audio tracks on the CD"; - stringsEvent[EVENT_INTERFACE_SOUND3D] = "3D sound\\3D positioning of the sound"; - - stringsEvent[EVENT_INTERFACE_MIN] = "Lowest\\Minimum graphic quality (highest frame rate)"; - stringsEvent[EVENT_INTERFACE_NORM] = "Normal\\Normal graphic quality"; - stringsEvent[EVENT_INTERFACE_MAX] = "Highest\\Highest graphic quality (lowest frame rate)"; - - stringsEvent[EVENT_INTERFACE_SILENT] = "Mute\\No sound"; - stringsEvent[EVENT_INTERFACE_NOISY] = "Normal\\Normal sound volume"; - - stringsEvent[EVENT_INTERFACE_JOYSTICK] = "Use a joystick\\Joystick or keyboard"; - stringsEvent[EVENT_INTERFACE_SOLUCE] = "Access to solution\\Shows the solution (detailed instructions for missions)"; - - stringsEvent[EVENT_INTERFACE_NEDIT] = "\\New player name"; - stringsEvent[EVENT_INTERFACE_NOK] = "OK\\Choose the selected player"; - stringsEvent[EVENT_INTERFACE_NCANCEL] = "Cancel\\Keep current player name"; - stringsEvent[EVENT_INTERFACE_NDELETE] = "Delete player\\Deletes the player from the list"; - stringsEvent[EVENT_INTERFACE_NLABEL] = "Player name"; - - stringsEvent[EVENT_INTERFACE_IOWRITE] = "Save\\Saves the current mission"; - stringsEvent[EVENT_INTERFACE_IOREAD] = "Load\\Loads the selected mission"; - stringsEvent[EVENT_INTERFACE_IOLIST] = "List of saved missions"; - stringsEvent[EVENT_INTERFACE_IOLABEL] = "Filename:"; - stringsEvent[EVENT_INTERFACE_IONAME] = "Mission name"; - stringsEvent[EVENT_INTERFACE_IOIMAGE] = "Photography"; - stringsEvent[EVENT_INTERFACE_IODELETE] = "Delete\\Deletes the selected file"; - - stringsEvent[EVENT_INTERFACE_PERSO] = "Appearance\\Choose your appearance"; - stringsEvent[EVENT_INTERFACE_POK] = "OK"; - stringsEvent[EVENT_INTERFACE_PCANCEL] = "Cancel"; - stringsEvent[EVENT_INTERFACE_PDEF] = "Standard\\Standard appearance settings"; - stringsEvent[EVENT_INTERFACE_PHEAD] = "Head\\Face and hair"; - stringsEvent[EVENT_INTERFACE_PBODY] = "Suit\\Astronaut suit"; - stringsEvent[EVENT_INTERFACE_PLROT] = "\\Turn left"; - stringsEvent[EVENT_INTERFACE_PRROT] = "\\Turn right"; - stringsEvent[EVENT_INTERFACE_PCRa] = "Red"; - stringsEvent[EVENT_INTERFACE_PCGa] = "Green"; - stringsEvent[EVENT_INTERFACE_PCBa] = "Blue"; - stringsEvent[EVENT_INTERFACE_PCRb] = "Red"; - stringsEvent[EVENT_INTERFACE_PCGb] = "Green"; - stringsEvent[EVENT_INTERFACE_PCBb] = "Blue"; - stringsEvent[EVENT_INTERFACE_PFACE1] = "\\Face 1"; - stringsEvent[EVENT_INTERFACE_PFACE2] = "\\Face 4"; - stringsEvent[EVENT_INTERFACE_PFACE3] = "\\Face 3"; - stringsEvent[EVENT_INTERFACE_PFACE4] = "\\Face 2"; - stringsEvent[EVENT_INTERFACE_PGLASS0] = "\\No eyeglasses"; - stringsEvent[EVENT_INTERFACE_PGLASS1] = "\\Eyeglasses 1"; - stringsEvent[EVENT_INTERFACE_PGLASS2] = "\\Eyeglasses 2"; - stringsEvent[EVENT_INTERFACE_PGLASS3] = "\\Eyeglasses 3"; - stringsEvent[EVENT_INTERFACE_PGLASS4] = "\\Eyeglasses 4"; - stringsEvent[EVENT_INTERFACE_PGLASS5] = "\\Eyeglasses 5"; - - stringsEvent[EVENT_OBJECT_DESELECT] = "Previous selection (\\key desel;)"; - stringsEvent[EVENT_OBJECT_LEFT] = "Turn left (\\key left;)"; - stringsEvent[EVENT_OBJECT_RIGHT] = "Turn right (\\key right;)"; - stringsEvent[EVENT_OBJECT_UP] = "Forward (\\key up;)"; - stringsEvent[EVENT_OBJECT_DOWN] = "Backward (\\key down;)"; - stringsEvent[EVENT_OBJECT_GASUP] = "Up (\\key gup;)"; - stringsEvent[EVENT_OBJECT_GASDOWN] = "Down (\\key gdown;)"; - stringsEvent[EVENT_OBJECT_HTAKE] = "Grab or drop (\\key action;)"; - stringsEvent[EVENT_OBJECT_MTAKE] = "Grab or drop (\\key action;)"; - stringsEvent[EVENT_OBJECT_MFRONT] = "..in front"; - stringsEvent[EVENT_OBJECT_MBACK] = "..behind"; - stringsEvent[EVENT_OBJECT_MPOWER] = "..power cell"; - stringsEvent[EVENT_OBJECT_BHELP] = "Instructions for the mission (\\key help;)"; - stringsEvent[EVENT_OBJECT_BTAKEOFF] = "Take off to finish the mission"; - stringsEvent[EVENT_OBJECT_BDESTROY] = "Destroy"; - stringsEvent[EVENT_OBJECT_BDERRICK] = "Build a derrick"; - stringsEvent[EVENT_OBJECT_BSTATION] = "Build a power station"; - stringsEvent[EVENT_OBJECT_BFACTORY] = "Build a bot factory"; - stringsEvent[EVENT_OBJECT_BREPAIR] = "Build a repair center"; - stringsEvent[EVENT_OBJECT_BCONVERT] = "Build a converter"; - stringsEvent[EVENT_OBJECT_BTOWER] = "Build a defense tower"; - stringsEvent[EVENT_OBJECT_BRESEARCH] = "Build a research center"; - stringsEvent[EVENT_OBJECT_BRADAR] = "Build a radar station"; - stringsEvent[EVENT_OBJECT_BENERGY] = "Build a power cell factory"; - stringsEvent[EVENT_OBJECT_BLABO] = "Build an autolab"; - stringsEvent[EVENT_OBJECT_BNUCLEAR] = "Build a nuclear power plant"; - stringsEvent[EVENT_OBJECT_BPARA] = "Build a lightning conductor"; - stringsEvent[EVENT_OBJECT_BINFO] = "Build a exchange post"; - stringsEvent[EVENT_OBJECT_BDESTROYER] = "Build a destroyer"; - stringsEvent[EVENT_OBJECT_GFLAT] = "Show if the ground is flat"; - stringsEvent[EVENT_OBJECT_FCREATE] = "Plant a flag"; - stringsEvent[EVENT_OBJECT_FDELETE] = "Remove a flag"; - stringsEvent[EVENT_OBJECT_FCOLORb] = "\\Blue flags"; - stringsEvent[EVENT_OBJECT_FCOLORr] = "\\Red flags"; - stringsEvent[EVENT_OBJECT_FCOLORg] = "\\Green flags"; - stringsEvent[EVENT_OBJECT_FCOLORy] = "\\Yellow flags"; - stringsEvent[EVENT_OBJECT_FCOLORv] = "\\Violet flags"; - stringsEvent[EVENT_OBJECT_FACTORYfa] = "Build a winged grabber"; - stringsEvent[EVENT_OBJECT_FACTORYta] = "Build a tracked grabber"; - stringsEvent[EVENT_OBJECT_FACTORYwa] = "Build a wheeled grabber"; - stringsEvent[EVENT_OBJECT_FACTORYia] = "Build a legged grabber"; - stringsEvent[EVENT_OBJECT_FACTORYfc] = "Build a winged shooter"; - stringsEvent[EVENT_OBJECT_FACTORYtc] = "Build a tracked shooter"; - stringsEvent[EVENT_OBJECT_FACTORYwc] = "Build a wheeled shooter"; - stringsEvent[EVENT_OBJECT_FACTORYic] = "Build a legged shooter"; - stringsEvent[EVENT_OBJECT_FACTORYfi] = "Build a winged orga shooter"; - stringsEvent[EVENT_OBJECT_FACTORYti] = "Build a tracked orga shooter"; - stringsEvent[EVENT_OBJECT_FACTORYwi] = "Build a wheeled orga shooter"; - stringsEvent[EVENT_OBJECT_FACTORYii] = "Build a legged orga shooter"; - stringsEvent[EVENT_OBJECT_FACTORYfs] = "Build a winged sniffer"; - stringsEvent[EVENT_OBJECT_FACTORYts] = "Build a tracked sniffer"; - stringsEvent[EVENT_OBJECT_FACTORYws] = "Build a wheeled sniffer"; - stringsEvent[EVENT_OBJECT_FACTORYis] = "Build a legged sniffer"; - stringsEvent[EVENT_OBJECT_FACTORYrt] = "Build a thumper"; - stringsEvent[EVENT_OBJECT_FACTORYrc] = "Build a phazer shooter"; - stringsEvent[EVENT_OBJECT_FACTORYrr] = "Build a recycler"; - stringsEvent[EVENT_OBJECT_FACTORYrs] = "Build a shielder"; - stringsEvent[EVENT_OBJECT_FACTORYsa] = "Build a subber"; - stringsEvent[EVENT_OBJECT_RTANK] = "Run research program for tracked bots"; - stringsEvent[EVENT_OBJECT_RFLY] = "Run research program for winged bots"; - stringsEvent[EVENT_OBJECT_RTHUMP] = "Run research program for thumper"; - stringsEvent[EVENT_OBJECT_RCANON] = "Run research program for shooter"; - stringsEvent[EVENT_OBJECT_RTOWER] = "Run research program for defense tower"; - stringsEvent[EVENT_OBJECT_RPHAZER] = "Run research program for phazer shooter"; - stringsEvent[EVENT_OBJECT_RSHIELD] = "Run research program for shielder"; - stringsEvent[EVENT_OBJECT_RATOMIC] = "Run research program for nuclear power"; - stringsEvent[EVENT_OBJECT_RiPAW] = "Run research program for legged bots"; - stringsEvent[EVENT_OBJECT_RiGUN] = "Run research program for orga shooter"; - stringsEvent[EVENT_OBJECT_RESET] = "Return to start"; - stringsEvent[EVENT_OBJECT_SEARCH] = "Sniff (\\key action;)"; - stringsEvent[EVENT_OBJECT_TERRAFORM] = "Thump (\\key action;)"; - stringsEvent[EVENT_OBJECT_FIRE] = "Shoot (\\key action;)"; - stringsEvent[EVENT_OBJECT_SPIDEREXPLO] = "Explode (\\key action;)"; - stringsEvent[EVENT_OBJECT_RECOVER] = "Recycle (\\key action;)"; - stringsEvent[EVENT_OBJECT_BEGSHIELD] = "Extend shield (\\key action;)"; - stringsEvent[EVENT_OBJECT_ENDSHIELD] = "Withdraw shield (\\key action;)"; - stringsEvent[EVENT_OBJECT_DIMSHIELD] = "Shield radius"; - stringsEvent[EVENT_OBJECT_PROGRUN] = "Execute the selected program"; - stringsEvent[EVENT_OBJECT_PROGEDIT] = "Edit the selected program"; - stringsEvent[EVENT_OBJECT_INFOOK] = "\\SatCom on standby"; - stringsEvent[EVENT_OBJECT_DELETE] = "Destroy the building"; - stringsEvent[EVENT_OBJECT_GENERGY] = "Energy level"; - stringsEvent[EVENT_OBJECT_GSHIELD] = "Shield level"; - stringsEvent[EVENT_OBJECT_GRANGE] = "Jet temperature"; - stringsEvent[EVENT_OBJECT_GPROGRESS] = "Still working ..."; - stringsEvent[EVENT_OBJECT_GRADAR] = "Number of insects detected"; - stringsEvent[EVENT_OBJECT_GINFO] = "Transmitted information"; - stringsEvent[EVENT_OBJECT_COMPASS] = "Compass"; - stringsEvent[EVENT_OBJECT_MAPZOOM] = "Zoom mini-map"; - stringsEvent[EVENT_OBJECT_CAMERA] = "Camera (\\key camera;)"; - stringsEvent[EVENT_OBJECT_CAMERAleft] = "Camera to left"; - stringsEvent[EVENT_OBJECT_CAMERAright] = "Camera to right"; - stringsEvent[EVENT_OBJECT_CAMERAnear] = "Camera nearest"; - stringsEvent[EVENT_OBJECT_CAMERAaway] = "Camera awayest"; - stringsEvent[EVENT_OBJECT_HELP] = "Help about selected object"; - stringsEvent[EVENT_OBJECT_SOLUCE] = "Show the solution"; - stringsEvent[EVENT_OBJECT_SHORTCUT00] = "Switch bots <-> buildings"; - stringsEvent[EVENT_OBJECT_LIMIT] = "Show the range"; - stringsEvent[EVENT_OBJECT_PEN0] = "\\Raise the pencil"; - stringsEvent[EVENT_OBJECT_PEN1] = "\\Use the black pencil"; - stringsEvent[EVENT_OBJECT_PEN2] = "\\Use the yellow pencil"; - stringsEvent[EVENT_OBJECT_PEN3] = "\\Use the orange pencil"; - stringsEvent[EVENT_OBJECT_PEN4] = "\\Use the red pencil"; - stringsEvent[EVENT_OBJECT_PEN5] = "\\Use the purple pencil"; - stringsEvent[EVENT_OBJECT_PEN6] = "\\Use the blue pencil"; - stringsEvent[EVENT_OBJECT_PEN7] = "\\Use the green pencil"; - stringsEvent[EVENT_OBJECT_PEN8] = "\\Use the brown pencil"; - stringsEvent[EVENT_OBJECT_REC] = "\\Start recording"; - stringsEvent[EVENT_OBJECT_STOP] = "\\Stop recording"; - stringsEvent[EVENT_DT_VISIT0] = "Show the place"; - stringsEvent[EVENT_DT_VISIT1] = "Show the place"; - stringsEvent[EVENT_DT_VISIT2] = "Show the place"; - stringsEvent[EVENT_DT_VISIT3] = "Show the place"; - stringsEvent[EVENT_DT_VISIT4] = "Show the place"; - stringsEvent[EVENT_DT_END] = "Continue"; - stringsEvent[EVENT_CMD] = "Command line"; - stringsEvent[EVENT_SPEED] = "Game speed"; - - stringsEvent[EVENT_HYPER_PREV] = "Back"; - stringsEvent[EVENT_HYPER_NEXT] = "Forward"; - stringsEvent[EVENT_HYPER_HOME] = "Home"; - stringsEvent[EVENT_HYPER_COPY] = "Copy"; - stringsEvent[EVENT_HYPER_SIZE1] = "Size 1"; - stringsEvent[EVENT_HYPER_SIZE2] = "Size 2"; - stringsEvent[EVENT_HYPER_SIZE3] = "Size 3"; - stringsEvent[EVENT_HYPER_SIZE4] = "Size 4"; - stringsEvent[EVENT_HYPER_SIZE5] = "Size 5"; - stringsEvent[EVENT_SATCOM_HUSTON] = "Instructions from Houston"; - stringsEvent[EVENT_SATCOM_SAT] = "Satellite report"; - stringsEvent[EVENT_SATCOM_LOADING] = "Programs dispatched by Houston"; - stringsEvent[EVENT_SATCOM_OBJECT] = "List of objects"; - stringsEvent[EVENT_SATCOM_PROG] = "Programming help"; - stringsEvent[EVENT_SATCOM_SOLUCE] = "Solution"; - - stringsEvent[EVENT_STUDIO_OK] = "OK\\Close program editor and return to game"; - stringsEvent[EVENT_STUDIO_CANCEL] = "Cancel\\Cancel all changes"; - stringsEvent[EVENT_STUDIO_NEW] = "New"; - stringsEvent[EVENT_STUDIO_OPEN] = "Open (Ctrl+o)"; - stringsEvent[EVENT_STUDIO_SAVE] = "Save (Ctrl+s)"; - stringsEvent[EVENT_STUDIO_UNDO] = "Undo (Ctrl+z)"; - stringsEvent[EVENT_STUDIO_CUT] = "Cut (Ctrl+x)"; - stringsEvent[EVENT_STUDIO_COPY] = "Copy (Ctrl+c)"; - stringsEvent[EVENT_STUDIO_PASTE] = "Paste (Ctrl+v)"; - stringsEvent[EVENT_STUDIO_SIZE] = "Font size"; - stringsEvent[EVENT_STUDIO_TOOL] = "Instructions (\\key help;)"; - stringsEvent[EVENT_STUDIO_HELP] = "Programming help (\\key prog;)"; - stringsEvent[EVENT_STUDIO_COMPILE] = "Compile"; - stringsEvent[EVENT_STUDIO_RUN] = "Execute/stop"; - stringsEvent[EVENT_STUDIO_REALTIME] = "Pause/continue"; - stringsEvent[EVENT_STUDIO_STEP] = "One step"; - - - - stringsObject[OBJECT_PORTICO] = "Gantry crane"; - stringsObject[OBJECT_BASE] = "Spaceship"; - stringsObject[OBJECT_DERRICK] = "Derrick"; - stringsObject[OBJECT_FACTORY] = "Bot factory"; - stringsObject[OBJECT_REPAIR] = "Repair center"; - stringsObject[OBJECT_DESTROYER] = "Destroyer"; - stringsObject[OBJECT_STATION] = "Power station"; - stringsObject[OBJECT_CONVERT] = "Converts ore to titanium"; - stringsObject[OBJECT_TOWER] = "Defense tower"; - stringsObject[OBJECT_NEST] = "Nest"; - stringsObject[OBJECT_RESEARCH] = "Research center"; - stringsObject[OBJECT_RADAR] = "Radar station"; - stringsObject[OBJECT_INFO] = "Information exchange post"; - stringsObject[OBJECT_ENERGY] = "Power cell factory"; - stringsObject[OBJECT_LABO] = "Autolab"; - stringsObject[OBJECT_NUCLEAR] = "Nuclear power station"; - stringsObject[OBJECT_PARA] = "Lightning conductor"; - stringsObject[OBJECT_SAFE] = "Vault"; - stringsObject[OBJECT_HUSTON] = "Houston Mission Control"; - stringsObject[OBJECT_TARGET1] = "Target"; - stringsObject[OBJECT_TARGET2] = "Target"; - stringsObject[OBJECT_START] = "Start"; - stringsObject[OBJECT_END] = "Finish"; - stringsObject[OBJECT_STONE] = "Titanium ore"; - stringsObject[OBJECT_URANIUM] = "Uranium ore"; - stringsObject[OBJECT_BULLET] = "Organic matter"; - stringsObject[OBJECT_METAL] = "Titanium"; - stringsObject[OBJECT_POWER] = "Power cell"; - stringsObject[OBJECT_ATOMIC] = "Nuclear power cell"; - stringsObject[OBJECT_BBOX] = "Black box"; - stringsObject[OBJECT_KEYa] = "Key A"; - stringsObject[OBJECT_KEYb] = "Key B"; - stringsObject[OBJECT_KEYc] = "Key C"; - stringsObject[OBJECT_KEYd] = "Key D"; - stringsObject[OBJECT_TNT] = "Explosive"; - stringsObject[OBJECT_BOMB] = "Fixed mine"; - stringsObject[OBJECT_BAG] = "Survival kit"; - stringsObject[OBJECT_WAYPOINT] = "Checkpoint"; - stringsObject[OBJECT_FLAGb] = "Blue flag"; - stringsObject[OBJECT_FLAGr] = "Red flag"; - stringsObject[OBJECT_FLAGg] = "Green flag"; - stringsObject[OBJECT_FLAGy] = "Yellow flag"; - stringsObject[OBJECT_FLAGv] = "Violet flag"; - stringsObject[OBJECT_MARKPOWER] = "Energy deposit (site for power station)"; - stringsObject[OBJECT_MARKURANIUM] = "Uranium deposit (site for derrick)"; - stringsObject[OBJECT_MARKKEYa] = "Found key A (site for derrick)"; - stringsObject[OBJECT_MARKKEYb] = "Found key B (site for derrick)"; - stringsObject[OBJECT_MARKKEYc] = "Found key C (site for derrick)"; - stringsObject[OBJECT_MARKKEYd] = "Found key D (site for derrick)"; - stringsObject[OBJECT_MARKSTONE] = "Titanium deposit (site for derrick)"; - stringsObject[OBJECT_MOBILEft] = "Practice bot"; - stringsObject[OBJECT_MOBILEtt] = "Practice bot"; - stringsObject[OBJECT_MOBILEwt] = "Practice bot"; - stringsObject[OBJECT_MOBILEit] = "Practice bot"; - stringsObject[OBJECT_MOBILEfa] = "Winged grabber"; - stringsObject[OBJECT_MOBILEta] = "Tracked grabber"; - stringsObject[OBJECT_MOBILEwa] = "Wheeled grabber"; - stringsObject[OBJECT_MOBILEia] = "Legged grabber"; - stringsObject[OBJECT_MOBILEfc] = "Winged shooter"; - stringsObject[OBJECT_MOBILEtc] = "Tracked shooter"; - stringsObject[OBJECT_MOBILEwc] = "Wheeled shooter"; - stringsObject[OBJECT_MOBILEic] = "Legged shooter"; - stringsObject[OBJECT_MOBILEfi] = "Winged orga shooter"; - stringsObject[OBJECT_MOBILEti] = "Tracked orga shooter"; - stringsObject[OBJECT_MOBILEwi] = "Wheeled orga shooter"; - stringsObject[OBJECT_MOBILEii] = "Legged orga shooter"; - stringsObject[OBJECT_MOBILEfs] = "Winged sniffer"; - stringsObject[OBJECT_MOBILEts] = "Tracked sniffer"; - stringsObject[OBJECT_MOBILEws] = "Wheeled sniffer"; - stringsObject[OBJECT_MOBILEis] = "Legged sniffer"; - stringsObject[OBJECT_MOBILErt] = "Thumper"; - stringsObject[OBJECT_MOBILErc] = "Phazer shooter"; - stringsObject[OBJECT_MOBILErr] = "Recycler"; - stringsObject[OBJECT_MOBILErs] = "Shielder"; - stringsObject[OBJECT_MOBILEsa] = "Subber"; - stringsObject[OBJECT_MOBILEtg] = "Target bot"; - stringsObject[OBJECT_MOBILEdr] = "Drawer bot"; - stringsObject[OBJECT_TECH] = "Engineer"; - stringsObject[OBJECT_TOTO] = "Robbie"; - stringsObject[OBJECT_MOTHER] = "Alien Queen"; - stringsObject[OBJECT_ANT] = "Ant"; - stringsObject[OBJECT_SPIDER] = "Spider"; - stringsObject[OBJECT_BEE] = "Wasp"; - stringsObject[OBJECT_WORM] = "Worm"; - stringsObject[OBJECT_EGG] = "Egg"; - stringsObject[OBJECT_RUINmobilew1] = "Wreckage"; - stringsObject[OBJECT_RUINmobilew2] = "Wreckage"; - stringsObject[OBJECT_RUINmobilet1] = "Wreckage"; - stringsObject[OBJECT_RUINmobilet2] = "Wreckage"; - stringsObject[OBJECT_RUINmobiler1] = "Wreckage"; - stringsObject[OBJECT_RUINmobiler2] = "Wreckage"; - stringsObject[OBJECT_RUINfactory] = "Ruin"; - stringsObject[OBJECT_RUINdoor] = "Ruin"; - stringsObject[OBJECT_RUINsupport] = "Waste"; - stringsObject[OBJECT_RUINradar] = "Ruin"; - stringsObject[OBJECT_RUINconvert] = "Ruin"; - stringsObject[OBJECT_RUINbase] = "Spaceship ruin"; - stringsObject[OBJECT_RUINhead] = "Spaceship ruin"; - stringsObject[OBJECT_APOLLO1] = "Remains of Apollo mission"; - stringsObject[OBJECT_APOLLO3] = "Remains of Apollo mission"; - stringsObject[OBJECT_APOLLO4] = "Remains of Apollo mission"; - stringsObject[OBJECT_APOLLO5] = "Remains of Apollo mission"; - stringsObject[OBJECT_APOLLO2] = "Lunar Roving Vehicle"; - - - - stringsErr[ERR_GENERIC] = "Internal error - tell the developers"; - stringsErr[ERR_CMD] = "Unknown command"; - stringsErr[ERR_MANIP_VEH] = "Inappropriate bot"; - stringsErr[ERR_MANIP_FLY] = "Impossible when flying"; - stringsErr[ERR_MANIP_BUSY] = "Already carrying something"; - stringsErr[ERR_MANIP_NIL] = "Nothing to grab"; - stringsErr[ERR_MANIP_MOTOR] = "Impossible when moving"; - stringsErr[ERR_MANIP_OCC] = "Place occupied"; - stringsErr[ERR_MANIP_FRIEND] = "No other robot"; - stringsErr[ERR_MANIP_RADIO] = "You can not carry a radioactive object"; - stringsErr[ERR_MANIP_WATER] = "You can not carry an object under water"; - stringsErr[ERR_MANIP_EMPTY] = "Nothing to drop"; - stringsErr[ERR_BUILD_FLY] = "Impossible when flying"; - stringsErr[ERR_BUILD_WATER] = "Impossible under water"; - stringsErr[ERR_BUILD_ENERGY] = "Not enough energy"; - stringsErr[ERR_BUILD_METALAWAY] = "Titanium too far away"; - stringsErr[ERR_BUILD_METALNEAR] = "Titanium too close"; - stringsErr[ERR_BUILD_METALINEX] = "No titanium around"; - stringsErr[ERR_BUILD_FLAT] = "Ground not flat enough"; - stringsErr[ERR_BUILD_FLATLIT] = "Flat ground not large enough"; - stringsErr[ERR_BUILD_BUSY] = "Place occupied"; - stringsErr[ERR_BUILD_BASE] = "Too close to space ship"; - stringsErr[ERR_BUILD_NARROW] = "Too close to a building"; - stringsErr[ERR_BUILD_MOTOR] = "Impossible when moving"; - stringsErr[ERR_SEARCH_FLY] = "Impossible when flying"; - stringsErr[ERR_BUILD_DISABLED] = "Can not produce this object in this mission"; - stringsErr[ERR_BUILD_RESEARCH] = "Can not produce not researched object"; - stringsErr[ERR_SEARCH_VEH] = "Inappropriate bot"; - stringsErr[ERR_SEARCH_MOTOR] = "Impossible when moving"; - stringsErr[ERR_TERRA_VEH] = "Inappropriate bot"; - stringsErr[ERR_TERRA_ENERGY] = "Not enough energy"; - stringsErr[ERR_TERRA_FLOOR] = "Ground inappropriate"; - stringsErr[ERR_TERRA_BUILDING] = "Building too close"; - stringsErr[ERR_TERRA_OBJECT] = "Object too close"; - stringsErr[ERR_RECOVER_VEH] = "Inappropriate bot"; - stringsErr[ERR_RECOVER_ENERGY] = "Not enough energy"; - stringsErr[ERR_RECOVER_NULL] = "Nothing to recycle"; - stringsErr[ERR_SHIELD_VEH] = "Inappropriate bot"; - stringsErr[ERR_SHIELD_ENERGY] = "No more energy"; - stringsErr[ERR_MOVE_IMPOSSIBLE] = "Error in instruction move"; - stringsErr[ERR_FIND_IMPOSSIBLE] = "Object not found"; - stringsErr[ERR_GOTO_IMPOSSIBLE] = "Goto: inaccessible destination"; - stringsErr[ERR_GOTO_ITER] = "Goto: inaccessible destination"; - stringsErr[ERR_GOTO_BUSY] = "Goto: destination occupied"; - stringsErr[ERR_FIRE_VEH] = "Inappropriate bot"; - stringsErr[ERR_FIRE_ENERGY] = "Not enough energy"; - stringsErr[ERR_FIRE_FLY] = "Impossible when flying"; - stringsErr[ERR_CONVERT_EMPTY] = "No titanium ore to convert"; - stringsErr[ERR_DERRICK_NULL] = "No ore in the subsoil"; - stringsErr[ERR_STATION_NULL] = "No energy in the subsoil"; - stringsErr[ERR_TOWER_POWER] = "No power cell"; - stringsErr[ERR_TOWER_ENERGY] = "No more energy"; - stringsErr[ERR_RESEARCH_POWER] = "No power cell"; - stringsErr[ERR_RESEARCH_ENERGY] = "Not enough energy"; - stringsErr[ERR_RESEARCH_TYPE] = "Inappropriate cell type"; - stringsErr[ERR_RESEARCH_ALREADY]= "Research program already performed"; - stringsErr[ERR_ENERGY_NULL] = "No energy in the subsoil"; - stringsErr[ERR_ENERGY_LOW] = "Not enough energy yet"; - stringsErr[ERR_ENERGY_EMPTY] = "No titanium to transform"; - stringsErr[ERR_ENERGY_BAD] = "Transforms only titanium"; - stringsErr[ERR_BASE_DLOCK] = "Doors blocked by a robot or another object "; - stringsErr[ERR_BASE_DHUMAN] = "You must get on the spaceship to take off "; - stringsErr[ERR_LABO_NULL] = "Nothing to analyze"; - stringsErr[ERR_LABO_BAD] = "Analyzes only organic matter"; - stringsErr[ERR_LABO_ALREADY] = "Analysis already performed"; - stringsErr[ERR_NUCLEAR_NULL] = "No energy in the subsoil"; - stringsErr[ERR_NUCLEAR_LOW] = "Not yet enough energy"; - stringsErr[ERR_NUCLEAR_EMPTY] = "No uranium to transform"; - stringsErr[ERR_NUCLEAR_BAD] = "Transforms only uranium"; - stringsErr[ERR_FACTORY_NULL] = "No titanium"; - stringsErr[ERR_FACTORY_NEAR] = "Object too close"; - stringsErr[ERR_RESET_NEAR] = "Place occupied"; - stringsErr[ERR_INFO_NULL] = "No information exchange post within range"; - stringsErr[ERR_VEH_VIRUS] = "Program infected by a virus"; - stringsErr[ERR_BAT_VIRUS] = "Infected by a virus; temporarily out of order"; - stringsErr[ERR_VEH_POWER] = "No power cell"; - stringsErr[ERR_VEH_ENERGY] = "No more energy"; - stringsErr[ERR_FLAG_FLY] = "Impossible when flying"; - stringsErr[ERR_FLAG_WATER] = "Impossible when swimming"; - stringsErr[ERR_FLAG_MOTOR] = "Impossible when moving"; - stringsErr[ERR_FLAG_BUSY] = "Impossible when carrying an object"; - stringsErr[ERR_FLAG_CREATE] = "Too many flags of this color (maximum 5)"; - stringsErr[ERR_FLAG_PROXY] = "Too close to an existing flag"; - stringsErr[ERR_FLAG_DELETE] = "No flag nearby"; - stringsErr[ERR_DESTROY_NOTFOUND]= "Not found anything to destroy"; - stringsErr[ERR_WRONG_OBJ] = "Inappropriate object"; - stringsErr[ERR_MISSION_NOTERM] = "The mission is not accomplished yet (press \\key help; for more details)"; - stringsErr[ERR_DELETEMOBILE] = "Bot destroyed"; - stringsErr[ERR_DELETEBUILDING] = "Building destroyed"; - stringsErr[ERR_TOOMANY] = "Can not create this; there are too many objects"; - stringsErr[ERR_OBLIGATORYTOKEN] = "\"%s\" missing in this exercise"; - stringsErr[ERR_PROHIBITEDTOKEN] = "Do not use in this exercise"; - - stringsErr[INFO_BUILD] = "Building completed"; - stringsErr[INFO_CONVERT] = "Titanium available"; - stringsErr[INFO_RESEARCH] = "Research program completed"; - stringsErr[INFO_RESEARCHTANK] = "Plans for tracked robots available "; - stringsErr[INFO_RESEARCHFLY] = "You can fly with the keys (\\key gup;) and (\\key gdown;)"; - stringsErr[INFO_RESEARCHTHUMP] = "Plans for thumper available"; - stringsErr[INFO_RESEARCHCANON] = "Plans for shooter available"; - stringsErr[INFO_RESEARCHTOWER] = "Plans for defense tower available"; - stringsErr[INFO_RESEARCHPHAZER] = "Plans for phazer shooter available"; - stringsErr[INFO_RESEARCHSHIELD] = "Plans for shielder available"; - stringsErr[INFO_RESEARCHATOMIC] = "Plans for nuclear power plant available"; - stringsErr[INFO_FACTORY] = "New bot available"; - stringsErr[INFO_LABO] = "Analysis performed"; - stringsErr[INFO_ENERGY] = "Power cell available"; - stringsErr[INFO_NUCLEAR] = "Nuclear power cell available"; - stringsErr[INFO_FINDING] = "You found a usable object"; - stringsErr[INFO_MARKPOWER] = "Found a site for power station"; - stringsErr[INFO_MARKURANIUM] = "Found a site for a derrick"; - stringsErr[INFO_MARKSTONE] = "Found a site for a derrick"; - stringsErr[INFO_MARKKEYa] = "Found a site for a derrick"; - stringsErr[INFO_MARKKEYb] = "Found a site for a derrick"; - stringsErr[INFO_MARKKEYc] = "Found a site for a derrick"; - stringsErr[INFO_MARKKEYd] = "Found a site for a derrick"; - stringsErr[INFO_WIN] = "<<< Well done; mission accomplished >>>"; - stringsErr[INFO_LOST] = "<<< Sorry; mission failed >>>"; - stringsErr[INFO_LOSTq] = "<<< Sorry; mission failed >>>"; - stringsErr[INFO_WRITEOK] = "Current mission saved"; - stringsErr[INFO_DELETEPATH] = "Checkpoint crossed"; - stringsErr[INFO_DELETEMOTHER] = "Alien Queen killed"; - stringsErr[INFO_DELETEANT] = "Ant fatally wounded"; - stringsErr[INFO_DELETEBEE] = "Wasp fatally wounded"; - stringsErr[INFO_DELETEWORM] = "Worm fatally wounded"; - stringsErr[INFO_DELETESPIDER] = "Spider fatally wounded"; - stringsErr[INFO_BEGINSATCOM] = "Press \\key help; to read instructions on your SatCom"; - - - - stringsCbot[TX_OPENPAR] = "Opening bracket missing"; - stringsCbot[TX_CLOSEPAR] = "Closing bracket missing "; - stringsCbot[TX_NOTBOOL] = "The expression must return a boolean value"; - stringsCbot[TX_UNDEFVAR] = "Variable not declared"; - stringsCbot[TX_BADLEFT] = "Assignment impossible"; - stringsCbot[TX_ENDOF] = "Semicolon terminator missing"; - stringsCbot[TX_OUTCASE] = "Instruction \"case\" outside a block \"switch\""; - stringsCbot[TX_NOTERM] = "Instructions after the final closing brace"; - stringsCbot[TX_CLOSEBLK] = "End of block missing"; - stringsCbot[TX_ELSEWITHOUTIF] = "Instruction \"else\" without corresponding \"if\" "; - stringsCbot[TX_OPENBLK] = "Opening brace missing "; - stringsCbot[TX_BADTYPE] = "Wrong type for the assignment"; - stringsCbot[TX_REDEFVAR] = "A variable can not be declared twice"; - stringsCbot[TX_BAD2TYPE] = "The types of the two operands are incompatible "; - stringsCbot[TX_UNDEFCALL] = "Unknown function"; - stringsCbot[TX_MISDOTS] = "Sign \" : \" missing"; - stringsCbot[TX_WHILE] = "Keyword \"while\" missing"; - stringsCbot[TX_BREAK] = "Instruction \"break\" outside a loop"; - stringsCbot[TX_LABEL] = "A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""; - stringsCbot[TX_NOLABEL] = "This label does not exist"; - stringsCbot[TX_NOCASE] = "Instruction \"case\" missing"; - stringsCbot[TX_BADNUM] = "Number missing"; - stringsCbot[TX_VOID] = "Void parameter"; - stringsCbot[TX_NOTYP] = "Type declaration missing"; - stringsCbot[TX_NOVAR] = "Variable name missing"; - stringsCbot[TX_NOFONC] = "Function name missing"; - stringsCbot[TX_OVERPARAM] = "Too many parameters"; - stringsCbot[TX_REDEF] = "Function already exists"; - stringsCbot[TX_LOWPARAM] = "Parameters missing "; - stringsCbot[TX_BADPARAM] = "No function with this name accepts this kind of parameter"; - stringsCbot[TX_NUMPARAM] = "No function with this name accepts this number of parameters"; - stringsCbot[TX_NOITEM] = "This is not a member of this class"; - stringsCbot[TX_DOT] = "This object is not a member of a class"; - stringsCbot[TX_NOCONST] = "Appropriate constructor missing"; - stringsCbot[TX_REDEFCLASS] = "This class already exists"; - stringsCbot[TX_CLBRK] = "\" ] \" missing"; - stringsCbot[TX_RESERVED] = "Reserved keyword of CBOT language"; - stringsCbot[TX_BADNEW] = "Bad argument for \"new\""; - stringsCbot[TX_OPBRK] = "\" [ \" expected"; - stringsCbot[TX_BADSTRING] = "String missing"; - stringsCbot[TX_BADINDEX] = "Incorrect index type"; - stringsCbot[TX_PRIVATE] = "Private element"; - stringsCbot[TX_NOPUBLIC] = "Public required"; - stringsCbot[TX_DIVZERO] = "Dividing by zero"; - stringsCbot[TX_NOTINIT] = "Variable not initialized"; - stringsCbot[TX_BADTHROW] = "Negative value rejected by \"throw\""; - stringsCbot[TX_NORETVAL] = "The function returned no value "; - stringsCbot[TX_NORUN] = "No function running"; - stringsCbot[TX_NOCALL] = "Calling an unknown function"; - stringsCbot[TX_NOCLASS] = "This class does not exist"; - stringsCbot[TX_NULLPT] = "Unknown Object"; - stringsCbot[TX_OPNAN] = "Operation impossible with value \"nan\""; - stringsCbot[TX_OUTARRAY] = "Access beyond array limit"; - stringsCbot[TX_STACKOVER] = "Stack overflow"; - stringsCbot[TX_DELETEDPT] = "Illegal object"; - stringsCbot[TX_FILEOPEN] = "Can't open file"; - stringsCbot[TX_NOTOPEN] = "File not open"; - stringsCbot[TX_ERRREAD] = "Read error"; - stringsCbot[TX_ERRWRITE] = "Write error"; + stringsText[RT_DISINFO_TITLE] = TR("SatCom"); + stringsText[RT_WINDOW_MAXIMIZED] = TR("Maximize"); + stringsText[RT_WINDOW_MINIMIZED] = TR("Minimize"); + stringsText[RT_WINDOW_STANDARD] = TR("Normal size"); + stringsText[RT_WINDOW_CLOSE] = TR("Close"); + + stringsText[RT_STUDIO_TITLE] = TR("Program editor"); + stringsText[RT_SCRIPT_NEW] = TR("New"); + stringsText[RT_NAME_DEFAULT] = TR("Player"); + stringsText[RT_IO_NEW] = TR("New ..."); + stringsText[RT_KEY_OR] = TR(" or "); + + stringsText[RT_TITLE_BASE] = TR("COLOBOT"); + stringsText[RT_TITLE_INIT] = TR("COLOBOT: Gold Edition"); + stringsText[RT_TITLE_TRAINER] = TR("Programming exercises"); + stringsText[RT_TITLE_DEFI] = TR("Challenges"); + stringsText[RT_TITLE_MISSION] = TR("Missions"); + stringsText[RT_TITLE_FREE] = TR("Free game"); + stringsText[RT_TITLE_USER] = TR("User levels"); + stringsText[RT_TITLE_SETUP] = TR("Options"); + stringsText[RT_TITLE_NAME] = TR("Player's name"); + stringsText[RT_TITLE_PERSO] = TR("Customize your appearance"); + stringsText[RT_TITLE_WRITE] = TR("Save the current mission"); + stringsText[RT_TITLE_READ] = TR("Load a saved mission"); + + stringsText[RT_PLAY_CHAPt] = TR(" Chapters:"); + stringsText[RT_PLAY_CHAPd] = TR(" Chapters:"); + stringsText[RT_PLAY_CHAPm] = TR(" Planets:"); + stringsText[RT_PLAY_CHAPf] = TR(" Planets:"); + stringsText[RT_PLAY_CHAPu] = TR(" User levels:"); + stringsText[RT_PLAY_CHAPte] = TR(" Chapters:"); + stringsText[RT_PLAY_LISTt] = TR(" Exercises in the chapter:"); + stringsText[RT_PLAY_LISTd] = TR(" Challenges in the chapter:"); + stringsText[RT_PLAY_LISTm] = TR(" Missions on this planet:"); + stringsText[RT_PLAY_LISTf] = TR(" Free game on this planet:"); + stringsText[RT_PLAY_LISTu] = TR(" Missions on this level:"); + stringsText[RT_PLAY_RESUME] = TR(" Summary:"); + + stringsText[RT_SETUP_DEVICE] = TR(" Drivers:"); + stringsText[RT_SETUP_MODE] = TR(" Resolution:"); + stringsText[RT_SETUP_KEY1] = TR("1) First click on the key you want to redefine."); + stringsText[RT_SETUP_KEY2] = TR("2) Then press the key you want to use instead."); + + stringsText[RT_PERSO_FACE] = TR("Face type:"); + stringsText[RT_PERSO_GLASSES] = TR("Eyeglasses:"); + stringsText[RT_PERSO_HAIR] = TR("Hair color:"); + stringsText[RT_PERSO_COMBI] = TR("Suit color:"); + stringsText[RT_PERSO_BAND] = TR("Strip color:"); + + stringsText[RT_DIALOG_QUIT] = TR("Do you want to quit COLOBOT ?"); + stringsText[RT_DIALOG_TITLE] = TR("COLOBOT"); + stringsText[RT_DIALOG_YESQUIT] = TR("Quit\\Quit COLOBOT"); + stringsText[RT_DIALOG_ABORT] = TR("Quit the mission?"); + stringsText[RT_DIALOG_YES] = TR("Abort\\Abort the current mission"); + stringsText[RT_DIALOG_NO] = TR("Continue\\Continue the current mission"); + stringsText[RT_DIALOG_NOQUIT] = TR("Continue\\Continue the game"); + stringsText[RT_DIALOG_DELOBJ] = TR("Do you really want to destroy the selected building?"); + stringsText[RT_DIALOG_DELGAME] = TR("Do you want to delete %s's saved games? "); + stringsText[RT_DIALOG_YESDEL] = TR("Delete"); + stringsText[RT_DIALOG_NODEL] = TR("Cancel"); + stringsText[RT_DIALOG_LOADING] = TR("LOADING"); + + stringsText[RT_STUDIO_LISTTT] = TR("Keyword help(\\key cbot;)"); + stringsText[RT_STUDIO_COMPOK] = TR("Compilation ok (0 errors)"); + stringsText[RT_STUDIO_PROGSTOP] = TR("Program finished"); + + stringsText[RT_SATCOM_LIST] = TR("\\b;List of objects\n"); + stringsText[RT_SATCOM_BOT] = TR("\\b;Robots\n"); + stringsText[RT_SATCOM_BUILDING] = TR("\\b;Buildings\n"); + stringsText[RT_SATCOM_FRET] = TR("\\b;Moveable objects\n"); + stringsText[RT_SATCOM_ALIEN] = TR("\\b;Aliens\n"); + stringsText[RT_SATCOM_NULL] = TR("\\c; (none)\\n;\n"); + stringsText[RT_SATCOM_ERROR1] = TR("\\b;Error\n"); + stringsText[RT_SATCOM_ERROR2] = TR("The list is only available if a \\l;radar station\\u object\\radar; is working.\n"); + + stringsText[RT_IO_OPEN] = TR("Open"); + stringsText[RT_IO_SAVE] = TR("Save"); + stringsText[RT_IO_LIST] = TR("Folder: %s"); + stringsText[RT_IO_NAME] = TR("Name:"); + stringsText[RT_IO_DIR] = TR("Folder:"); + stringsText[RT_IO_PRIVATE] = TR("Private\\Private folder"); + stringsText[RT_IO_PUBLIC] = TR("Public\\Common folder"); + + stringsText[RT_GENERIC_DEV1] = TR("Developed by :"); + stringsText[RT_GENERIC_DEV2] = TR("www.epsitec.com"); + stringsText[RT_GENERIC_EDIT1] = TR(" "); + stringsText[RT_GENERIC_EDIT2] = TR(" "); + + stringsText[RT_INTERFACE_REC] = TR("Recorder"); + + + + stringsEvent[EVENT_BUTTON_OK] = TR("OK"); + stringsEvent[EVENT_BUTTON_CANCEL] = TR("Cancel"); + stringsEvent[EVENT_BUTTON_NEXT] = TR("Next"); + stringsEvent[EVENT_BUTTON_PREV] = TR("Previous"); + + stringsEvent[EVENT_DIALOG_OK] = TR("OK"); + stringsEvent[EVENT_DIALOG_CANCEL] = TR("Cancel"); + + stringsEvent[EVENT_INTERFACE_TRAINER] = TR("Exercises\\Programming exercises"); + stringsEvent[EVENT_INTERFACE_DEFI] = TR("Challenges\\Programming challenges"); + stringsEvent[EVENT_INTERFACE_MISSION] = TR("Missions\\Select mission"); + stringsEvent[EVENT_INTERFACE_FREE] = TR("Free game\\Free game without a specific goal"); + stringsEvent[EVENT_INTERFACE_USER] = TR("User\\User levels"); + stringsEvent[EVENT_INTERFACE_NAME] = TR("Change player\\Change player"); + stringsEvent[EVENT_INTERFACE_SETUP] = TR("Options\\Preferences"); + stringsEvent[EVENT_INTERFACE_AGAIN] = TR("Restart\\Restart the mission from the beginning"); + stringsEvent[EVENT_INTERFACE_WRITE] = TR("Save\\Save the current mission "); + stringsEvent[EVENT_INTERFACE_READ] = TR("Load\\Load a saved mission"); + stringsEvent[EVENT_INTERFACE_ABORT] = TR("\\Return to COLOBOT"); + stringsEvent[EVENT_INTERFACE_QUIT] = TR("Quit\\Quit COLOBOT"); + stringsEvent[EVENT_INTERFACE_BACK] = TR("<< Back \\Back to the previous screen"); + stringsEvent[EVENT_INTERFACE_PLAY] = TR("Play\\Start mission!"); + stringsEvent[EVENT_INTERFACE_SETUPd] = TR("Device\\Driver and resolution settings"); + stringsEvent[EVENT_INTERFACE_SETUPg] = TR("Graphics\\Graphics settings"); + stringsEvent[EVENT_INTERFACE_SETUPp] = TR("Game\\Game settings"); + stringsEvent[EVENT_INTERFACE_SETUPc] = TR("Controls\\Keyboard, joystick and mouse settings"); + stringsEvent[EVENT_INTERFACE_SETUPs] = TR("Sound\\Music and game sound volume"); + stringsEvent[EVENT_INTERFACE_DEVICE] = TR("Unit"); + stringsEvent[EVENT_INTERFACE_RESOL] = TR("Resolution"); + stringsEvent[EVENT_INTERFACE_FULL] = TR("Full screen\\Full screen or window mode"); + stringsEvent[EVENT_INTERFACE_APPLY] = TR("Apply changes\\Activates the changed settings"); + + stringsEvent[EVENT_INTERFACE_TOTO] = TR("Robbie\\Your assistant"); + stringsEvent[EVENT_INTERFACE_SHADOW] = TR("Shadows\\Shadows on the ground"); + stringsEvent[EVENT_INTERFACE_GROUND] = TR("Marks on the ground\\Marks on the ground"); + stringsEvent[EVENT_INTERFACE_DIRTY] = TR("Dust\\Dust and dirt on bots and buildings"); + stringsEvent[EVENT_INTERFACE_FOG] = TR("Fog\\Fog"); + stringsEvent[EVENT_INTERFACE_LENS] = TR("Sunbeams\\Sunbeams in the sky"); + stringsEvent[EVENT_INTERFACE_SKY] = TR("Sky\\Clouds and nebulae"); + stringsEvent[EVENT_INTERFACE_PLANET] = TR("Planets and stars\\Astronomical objects in the sky"); + stringsEvent[EVENT_INTERFACE_LIGHT] = TR("Dynamic lighting\\Mobile light sources"); + stringsEvent[EVENT_INTERFACE_PARTI] = TR("Number of particles\\Explosions, dust, reflections, etc."); + stringsEvent[EVENT_INTERFACE_CLIP] = TR("Depth of field\\Maximum visibility"); + stringsEvent[EVENT_INTERFACE_DETAIL] = TR("Details\\Visual quality of 3D objects"); + stringsEvent[EVENT_INTERFACE_TEXTURE] = TR("Textures\\Quality of textures "); + stringsEvent[EVENT_INTERFACE_GADGET] = TR("Num of decorative objects\\Number of purely ornamental objects"); + stringsEvent[EVENT_INTERFACE_RAIN] = TR("Particles in the interface\\Steam clouds and sparks in the interface"); + stringsEvent[EVENT_INTERFACE_GLINT] = TR("Reflections on the buttons \\Shiny buttons"); + stringsEvent[EVENT_INTERFACE_TOOLTIP] = TR("Help balloons\\Explain the function of the buttons"); + stringsEvent[EVENT_INTERFACE_MOVIES] = TR("Film sequences\\Films before and after the missions"); + stringsEvent[EVENT_INTERFACE_NICERST] = TR("Exit film\\Film at the exit of exercises"); + stringsEvent[EVENT_INTERFACE_HIMSELF] = TR("Friendly fire\\Your shooting can damage your own objects "); + stringsEvent[EVENT_INTERFACE_SCROLL] = TR("Scrolling\\Scrolling when the mouse touches right or left border"); + stringsEvent[EVENT_INTERFACE_INVERTX] = TR("Mouse inversion X\\Inversion of the scrolling direction on the X axis"); + stringsEvent[EVENT_INTERFACE_INVERTY] = TR("Mouse inversion Y\\Inversion of the scrolling direction on the Y axis"); + stringsEvent[EVENT_INTERFACE_EFFECT] = TR("Quake at explosions\\The screen shakes at explosions"); + stringsEvent[EVENT_INTERFACE_MOUSE] = TR("Mouse shadow\\Gives the mouse a shadow"); + stringsEvent[EVENT_INTERFACE_EDITMODE] = TR("Automatic indent\\When program editing"); + stringsEvent[EVENT_INTERFACE_EDITVALUE] = TR("Big indent\\Indent 2 or 4 spaces per level defined by braces"); + stringsEvent[EVENT_INTERFACE_SOLUCE4] = TR("Access to solutions\\Show program \"4: Solution\" in the exercises"); + stringsEvent[EVENT_INTERFACE_BLOOD] = TR("Blood\\Display blood when the astronaut or the alien queen is hit"); + + stringsEvent[EVENT_INTERFACE_KDEF] = TR("Standard controls\\Standard key functions"); + stringsEvent[EVENT_INTERFACE_KLEFT] = TR("Turn left\\turns the bot to the left"); + stringsEvent[EVENT_INTERFACE_KRIGHT] = TR("Turn right\\turns the bot to the right"); + stringsEvent[EVENT_INTERFACE_KUP] = TR("Forward\\Moves forward"); + stringsEvent[EVENT_INTERFACE_KDOWN] = TR("Backward\\Moves backward"); + stringsEvent[EVENT_INTERFACE_KGUP] = TR("Climb\\Increases the power of the jet"); + stringsEvent[EVENT_INTERFACE_KGDOWN] = TR("Descend\\Reduces the power of the jet"); + stringsEvent[EVENT_INTERFACE_KCAMERA] = TR("Change camera\\Switches between onboard camera and following camera"); + stringsEvent[EVENT_INTERFACE_KDESEL] = TR("Previous object\\Selects the previous object"); + stringsEvent[EVENT_INTERFACE_KACTION] = TR("Standard action\\Standard action of the bot (take/grab, shoot, sniff, etc)"); + stringsEvent[EVENT_INTERFACE_KNEAR] = TR("Camera closer\\Moves the camera forward"); + stringsEvent[EVENT_INTERFACE_KAWAY] = TR("Camera back\\Moves the camera backward"); + stringsEvent[EVENT_INTERFACE_KNEXT] = TR("Next object\\Selects the next object"); + stringsEvent[EVENT_INTERFACE_KHUMAN] = TR("Select the astronaut\\Selects the astronaut"); + stringsEvent[EVENT_INTERFACE_KQUIT] = TR("Quit\\Quit the current mission or exercise"); + stringsEvent[EVENT_INTERFACE_KHELP] = TR("Instructions\\Shows the instructions for the current mission"); + stringsEvent[EVENT_INTERFACE_KPROG] = TR("Programming help\\Gives more detailed help with programming"); + stringsEvent[EVENT_INTERFACE_KCBOT] = TR("Key word help\\More detailed help about key words"); + stringsEvent[EVENT_INTERFACE_KVISIT] = TR("Origin of last message\\Shows where the last message was sent from"); + stringsEvent[EVENT_INTERFACE_KSPEED10] = TR("Speed 1.0x\\Normal speed"); + stringsEvent[EVENT_INTERFACE_KSPEED15] = TR("Speed 1.5x\\1.5 times faster"); + stringsEvent[EVENT_INTERFACE_KSPEED20] = TR("Speed 2.0x\\Double speed"); + stringsEvent[EVENT_INTERFACE_KSPEED30] = TR("Speed 3.0x\\Three times faster"); + + stringsEvent[EVENT_INTERFACE_VOLSOUND] = TR("Sound effects:\\Volume of engines, voice, shooting, etc."); + stringsEvent[EVENT_INTERFACE_VOLMUSIC] = TR("Background sound :\\Volume of audio tracks on the CD"); + stringsEvent[EVENT_INTERFACE_SOUND3D] = TR("3D sound\\3D positioning of the sound"); + + stringsEvent[EVENT_INTERFACE_MIN] = TR("Lowest\\Minimum graphic quality (highest frame rate)"); + stringsEvent[EVENT_INTERFACE_NORM] = TR("Normal\\Normal graphic quality"); + stringsEvent[EVENT_INTERFACE_MAX] = TR("Highest\\Highest graphic quality (lowest frame rate)"); + + stringsEvent[EVENT_INTERFACE_SILENT] = TR("Mute\\No sound"); + stringsEvent[EVENT_INTERFACE_NOISY] = TR("Normal\\Normal sound volume"); + + stringsEvent[EVENT_INTERFACE_JOYSTICK] = TR("Use a joystick\\Joystick or keyboard"); + stringsEvent[EVENT_INTERFACE_SOLUCE] = TR("Access to solution\\Shows the solution (detailed instructions for missions)"); + + stringsEvent[EVENT_INTERFACE_NEDIT] = TR("\\New player name"); + stringsEvent[EVENT_INTERFACE_NOK] = TR("OK\\Choose the selected player"); + stringsEvent[EVENT_INTERFACE_NCANCEL] = TR("Cancel\\Keep current player name"); + stringsEvent[EVENT_INTERFACE_NDELETE] = TR("Delete player\\Deletes the player from the list"); + stringsEvent[EVENT_INTERFACE_NLABEL] = TR("Player name"); + + stringsEvent[EVENT_INTERFACE_IOWRITE] = TR("Save\\Saves the current mission"); + stringsEvent[EVENT_INTERFACE_IOREAD] = TR("Load\\Loads the selected mission"); + stringsEvent[EVENT_INTERFACE_IOLIST] = TR("List of saved missions"); + stringsEvent[EVENT_INTERFACE_IOLABEL] = TR("Filename:"); + stringsEvent[EVENT_INTERFACE_IONAME] = TR("Mission name"); + stringsEvent[EVENT_INTERFACE_IOIMAGE] = TR("Photography"); + stringsEvent[EVENT_INTERFACE_IODELETE] = TR("Delete\\Deletes the selected file"); + + stringsEvent[EVENT_INTERFACE_PERSO] = TR("Appearance\\Choose your appearance"); + stringsEvent[EVENT_INTERFACE_POK] = TR("OK"); + stringsEvent[EVENT_INTERFACE_PCANCEL] = TR("Cancel"); + stringsEvent[EVENT_INTERFACE_PDEF] = TR("Standard\\Standard appearance settings"); + stringsEvent[EVENT_INTERFACE_PHEAD] = TR("Head\\Face and hair"); + stringsEvent[EVENT_INTERFACE_PBODY] = TR("Suit\\Astronaut suit"); + stringsEvent[EVENT_INTERFACE_PLROT] = TR("\\Turn left"); + stringsEvent[EVENT_INTERFACE_PRROT] = TR("\\Turn right"); + stringsEvent[EVENT_INTERFACE_PCRa] = TR("Red"); + stringsEvent[EVENT_INTERFACE_PCGa] = TR("Green"); + stringsEvent[EVENT_INTERFACE_PCBa] = TR("Blue"); + stringsEvent[EVENT_INTERFACE_PCRb] = TR("Red"); + stringsEvent[EVENT_INTERFACE_PCGb] = TR("Green"); + stringsEvent[EVENT_INTERFACE_PCBb] = TR("Blue"); + stringsEvent[EVENT_INTERFACE_PFACE1] = TR("\\Face 1"); + stringsEvent[EVENT_INTERFACE_PFACE2] = TR("\\Face 4"); + stringsEvent[EVENT_INTERFACE_PFACE3] = TR("\\Face 3"); + stringsEvent[EVENT_INTERFACE_PFACE4] = TR("\\Face 2"); + stringsEvent[EVENT_INTERFACE_PGLASS0] = TR("\\No eyeglasses"); + stringsEvent[EVENT_INTERFACE_PGLASS1] = TR("\\Eyeglasses 1"); + stringsEvent[EVENT_INTERFACE_PGLASS2] = TR("\\Eyeglasses 2"); + stringsEvent[EVENT_INTERFACE_PGLASS3] = TR("\\Eyeglasses 3"); + stringsEvent[EVENT_INTERFACE_PGLASS4] = TR("\\Eyeglasses 4"); + stringsEvent[EVENT_INTERFACE_PGLASS5] = TR("\\Eyeglasses 5"); + + stringsEvent[EVENT_OBJECT_DESELECT] = TR("Previous selection (\\key desel;)"); + stringsEvent[EVENT_OBJECT_LEFT] = TR("Turn left (\\key left;)"); + stringsEvent[EVENT_OBJECT_RIGHT] = TR("Turn right (\\key right;)"); + stringsEvent[EVENT_OBJECT_UP] = TR("Forward (\\key up;)"); + stringsEvent[EVENT_OBJECT_DOWN] = TR("Backward (\\key down;)"); + stringsEvent[EVENT_OBJECT_GASUP] = TR("Up (\\key gup;)"); + stringsEvent[EVENT_OBJECT_GASDOWN] = TR("Down (\\key gdown;)"); + stringsEvent[EVENT_OBJECT_HTAKE] = TR("Grab or drop (\\key action;)"); + stringsEvent[EVENT_OBJECT_MTAKE] = TR("Grab or drop (\\key action;)"); + stringsEvent[EVENT_OBJECT_MFRONT] = TR("..in front"); + stringsEvent[EVENT_OBJECT_MBACK] = TR("..behind"); + stringsEvent[EVENT_OBJECT_MPOWER] = TR("..power cell"); + stringsEvent[EVENT_OBJECT_BHELP] = TR("Instructions for the mission (\\key help;)"); + stringsEvent[EVENT_OBJECT_BTAKEOFF] = TR("Take off to finish the mission"); + stringsEvent[EVENT_OBJECT_BDESTROY] = TR("Destroy"); + stringsEvent[EVENT_OBJECT_BDERRICK] = TR("Build a derrick"); + stringsEvent[EVENT_OBJECT_BSTATION] = TR("Build a power station"); + stringsEvent[EVENT_OBJECT_BFACTORY] = TR("Build a bot factory"); + stringsEvent[EVENT_OBJECT_BREPAIR] = TR("Build a repair center"); + stringsEvent[EVENT_OBJECT_BCONVERT] = TR("Build a converter"); + stringsEvent[EVENT_OBJECT_BTOWER] = TR("Build a defense tower"); + stringsEvent[EVENT_OBJECT_BRESEARCH] = TR("Build a research center"); + stringsEvent[EVENT_OBJECT_BRADAR] = TR("Build a radar station"); + stringsEvent[EVENT_OBJECT_BENERGY] = TR("Build a power cell factory"); + stringsEvent[EVENT_OBJECT_BLABO] = TR("Build an autolab"); + stringsEvent[EVENT_OBJECT_BNUCLEAR] = TR("Build a nuclear power plant"); + stringsEvent[EVENT_OBJECT_BPARA] = TR("Build a lightning conductor"); + stringsEvent[EVENT_OBJECT_BINFO] = TR("Build a exchange post"); + stringsEvent[EVENT_OBJECT_BDESTROYER] = TR("Build a destroyer"); + stringsEvent[EVENT_OBJECT_GFLAT] = TR("Show if the ground is flat"); + stringsEvent[EVENT_OBJECT_FCREATE] = TR("Plant a flag"); + stringsEvent[EVENT_OBJECT_FDELETE] = TR("Remove a flag"); + stringsEvent[EVENT_OBJECT_FCOLORb] = TR("\\Blue flags"); + stringsEvent[EVENT_OBJECT_FCOLORr] = TR("\\Red flags"); + stringsEvent[EVENT_OBJECT_FCOLORg] = TR("\\Green flags"); + stringsEvent[EVENT_OBJECT_FCOLORy] = TR("\\Yellow flags"); + stringsEvent[EVENT_OBJECT_FCOLORv] = TR("\\Violet flags"); + stringsEvent[EVENT_OBJECT_FACTORYfa] = TR("Build a winged grabber"); + stringsEvent[EVENT_OBJECT_FACTORYta] = TR("Build a tracked grabber"); + stringsEvent[EVENT_OBJECT_FACTORYwa] = TR("Build a wheeled grabber"); + stringsEvent[EVENT_OBJECT_FACTORYia] = TR("Build a legged grabber"); + stringsEvent[EVENT_OBJECT_FACTORYfc] = TR("Build a winged shooter"); + stringsEvent[EVENT_OBJECT_FACTORYtc] = TR("Build a tracked shooter"); + stringsEvent[EVENT_OBJECT_FACTORYwc] = TR("Build a wheeled shooter"); + stringsEvent[EVENT_OBJECT_FACTORYic] = TR("Build a legged shooter"); + stringsEvent[EVENT_OBJECT_FACTORYfi] = TR("Build a winged orga shooter"); + stringsEvent[EVENT_OBJECT_FACTORYti] = TR("Build a tracked orga shooter"); + stringsEvent[EVENT_OBJECT_FACTORYwi] = TR("Build a wheeled orga shooter"); + stringsEvent[EVENT_OBJECT_FACTORYii] = TR("Build a legged orga shooter"); + stringsEvent[EVENT_OBJECT_FACTORYfs] = TR("Build a winged sniffer"); + stringsEvent[EVENT_OBJECT_FACTORYts] = TR("Build a tracked sniffer"); + stringsEvent[EVENT_OBJECT_FACTORYws] = TR("Build a wheeled sniffer"); + stringsEvent[EVENT_OBJECT_FACTORYis] = TR("Build a legged sniffer"); + stringsEvent[EVENT_OBJECT_FACTORYrt] = TR("Build a thumper"); + stringsEvent[EVENT_OBJECT_FACTORYrc] = TR("Build a phazer shooter"); + stringsEvent[EVENT_OBJECT_FACTORYrr] = TR("Build a recycler"); + stringsEvent[EVENT_OBJECT_FACTORYrs] = TR("Build a shielder"); + stringsEvent[EVENT_OBJECT_FACTORYsa] = TR("Build a subber"); + stringsEvent[EVENT_OBJECT_RTANK] = TR("Run research program for tracked bots"); + stringsEvent[EVENT_OBJECT_RFLY] = TR("Run research program for winged bots"); + stringsEvent[EVENT_OBJECT_RTHUMP] = TR("Run research program for thumper"); + stringsEvent[EVENT_OBJECT_RCANON] = TR("Run research program for shooter"); + stringsEvent[EVENT_OBJECT_RTOWER] = TR("Run research program for defense tower"); + stringsEvent[EVENT_OBJECT_RPHAZER] = TR("Run research program for phazer shooter"); + stringsEvent[EVENT_OBJECT_RSHIELD] = TR("Run research program for shielder"); + stringsEvent[EVENT_OBJECT_RATOMIC] = TR("Run research program for nuclear power"); + stringsEvent[EVENT_OBJECT_RiPAW] = TR("Run research program for legged bots"); + stringsEvent[EVENT_OBJECT_RiGUN] = TR("Run research program for orga shooter"); + stringsEvent[EVENT_OBJECT_RESET] = TR("Return to start"); + stringsEvent[EVENT_OBJECT_SEARCH] = TR("Sniff (\\key action;)"); + stringsEvent[EVENT_OBJECT_TERRAFORM] = TR("Thump (\\key action;)"); + stringsEvent[EVENT_OBJECT_FIRE] = TR("Shoot (\\key action;)"); + stringsEvent[EVENT_OBJECT_SPIDEREXPLO] = TR("Explode (\\key action;)"); + stringsEvent[EVENT_OBJECT_RECOVER] = TR("Recycle (\\key action;)"); + stringsEvent[EVENT_OBJECT_BEGSHIELD] = TR("Extend shield (\\key action;)"); + stringsEvent[EVENT_OBJECT_ENDSHIELD] = TR("Withdraw shield (\\key action;)"); + stringsEvent[EVENT_OBJECT_DIMSHIELD] = TR("Shield radius"); + stringsEvent[EVENT_OBJECT_PROGRUN] = TR("Execute the selected program"); + stringsEvent[EVENT_OBJECT_PROGEDIT] = TR("Edit the selected program"); + stringsEvent[EVENT_OBJECT_INFOOK] = TR("\\SatCom on standby"); + stringsEvent[EVENT_OBJECT_DELETE] = TR("Destroy the building"); + stringsEvent[EVENT_OBJECT_GENERGY] = TR("Energy level"); + stringsEvent[EVENT_OBJECT_GSHIELD] = TR("Shield level"); + stringsEvent[EVENT_OBJECT_GRANGE] = TR("Jet temperature"); + stringsEvent[EVENT_OBJECT_GPROGRESS] = TR("Still working ..."); + stringsEvent[EVENT_OBJECT_GRADAR] = TR("Number of insects detected"); + stringsEvent[EVENT_OBJECT_GINFO] = TR("Transmitted information"); + stringsEvent[EVENT_OBJECT_COMPASS] = TR("Compass"); + stringsEvent[EVENT_OBJECT_MAPZOOM] = TR("Zoom mini-map"); + stringsEvent[EVENT_OBJECT_CAMERA] = TR("Camera (\\key camera;)"); + stringsEvent[EVENT_OBJECT_CAMERAleft] = TR("Camera to left"); + stringsEvent[EVENT_OBJECT_CAMERAright] = TR("Camera to right"); + stringsEvent[EVENT_OBJECT_CAMERAnear] = TR("Camera nearest"); + stringsEvent[EVENT_OBJECT_CAMERAaway] = TR("Camera awayest"); + stringsEvent[EVENT_OBJECT_HELP] = TR("Help about selected object"); + stringsEvent[EVENT_OBJECT_SOLUCE] = TR("Show the solution"); + stringsEvent[EVENT_OBJECT_SHORTCUT00] = TR("Switch bots <-> buildings"); + stringsEvent[EVENT_OBJECT_LIMIT] = TR("Show the range"); + stringsEvent[EVENT_OBJECT_PEN0] = TR("\\Raise the pencil"); + stringsEvent[EVENT_OBJECT_PEN1] = TR("\\Use the black pencil"); + stringsEvent[EVENT_OBJECT_PEN2] = TR("\\Use the yellow pencil"); + stringsEvent[EVENT_OBJECT_PEN3] = TR("\\Use the orange pencil"); + stringsEvent[EVENT_OBJECT_PEN4] = TR("\\Use the red pencil"); + stringsEvent[EVENT_OBJECT_PEN5] = TR("\\Use the purple pencil"); + stringsEvent[EVENT_OBJECT_PEN6] = TR("\\Use the blue pencil"); + stringsEvent[EVENT_OBJECT_PEN7] = TR("\\Use the green pencil"); + stringsEvent[EVENT_OBJECT_PEN8] = TR("\\Use the brown pencil"); + stringsEvent[EVENT_OBJECT_REC] = TR("\\Start recording"); + stringsEvent[EVENT_OBJECT_STOP] = TR("\\Stop recording"); + stringsEvent[EVENT_DT_VISIT0] = TR("Show the place"); + stringsEvent[EVENT_DT_VISIT1] = TR("Show the place"); + stringsEvent[EVENT_DT_VISIT2] = TR("Show the place"); + stringsEvent[EVENT_DT_VISIT3] = TR("Show the place"); + stringsEvent[EVENT_DT_VISIT4] = TR("Show the place"); + stringsEvent[EVENT_DT_END] = TR("Continue"); + stringsEvent[EVENT_CMD] = TR("Command line"); + stringsEvent[EVENT_SPEED] = TR("Game speed"); + + stringsEvent[EVENT_HYPER_PREV] = TR("Back"); + stringsEvent[EVENT_HYPER_NEXT] = TR("Forward"); + stringsEvent[EVENT_HYPER_HOME] = TR("Home"); + stringsEvent[EVENT_HYPER_COPY] = TR("Copy"); + stringsEvent[EVENT_HYPER_SIZE1] = TR("Size 1"); + stringsEvent[EVENT_HYPER_SIZE2] = TR("Size 2"); + stringsEvent[EVENT_HYPER_SIZE3] = TR("Size 3"); + stringsEvent[EVENT_HYPER_SIZE4] = TR("Size 4"); + stringsEvent[EVENT_HYPER_SIZE5] = TR("Size 5"); + stringsEvent[EVENT_SATCOM_HUSTON] = TR("Instructions from Houston"); + stringsEvent[EVENT_SATCOM_SAT] = TR("Satellite report"); + stringsEvent[EVENT_SATCOM_LOADING] = TR("Programs dispatched by Houston"); + stringsEvent[EVENT_SATCOM_OBJECT] = TR("List of objects"); + stringsEvent[EVENT_SATCOM_PROG] = TR("Programming help"); + stringsEvent[EVENT_SATCOM_SOLUCE] = TR("Solution"); + + stringsEvent[EVENT_STUDIO_OK] = TR("OK\\Close program editor and return to game"); + stringsEvent[EVENT_STUDIO_CANCEL] = TR("Cancel\\Cancel all changes"); + stringsEvent[EVENT_STUDIO_NEW] = TR("New"); + stringsEvent[EVENT_STUDIO_OPEN] = TR("Open (Ctrl+o)"); + stringsEvent[EVENT_STUDIO_SAVE] = TR("Save (Ctrl+s)"); + stringsEvent[EVENT_STUDIO_UNDO] = TR("Undo (Ctrl+z)"); + stringsEvent[EVENT_STUDIO_CUT] = TR("Cut (Ctrl+x)"); + stringsEvent[EVENT_STUDIO_COPY] = TR("Copy (Ctrl+c)"); + stringsEvent[EVENT_STUDIO_PASTE] = TR("Paste (Ctrl+v)"); + stringsEvent[EVENT_STUDIO_SIZE] = TR("Font size"); + stringsEvent[EVENT_STUDIO_TOOL] = TR("Instructions (\\key help;)"); + stringsEvent[EVENT_STUDIO_HELP] = TR("Programming help (\\key prog;)"); + stringsEvent[EVENT_STUDIO_COMPILE] = TR("Compile"); + stringsEvent[EVENT_STUDIO_RUN] = TR("Execute/stop"); + stringsEvent[EVENT_STUDIO_REALTIME] = TR("Pause/continue"); + stringsEvent[EVENT_STUDIO_STEP] = TR("One step"); + + + + stringsObject[OBJECT_PORTICO] = TR("Gantry crane"); + stringsObject[OBJECT_BASE] = TR("Spaceship"); + stringsObject[OBJECT_DERRICK] = TR("Derrick"); + stringsObject[OBJECT_FACTORY] = TR("Bot factory"); + stringsObject[OBJECT_REPAIR] = TR("Repair center"); + stringsObject[OBJECT_DESTROYER] = TR("Destroyer"); + stringsObject[OBJECT_STATION] = TR("Power station"); + stringsObject[OBJECT_CONVERT] = TR("Converts ore to titanium"); + stringsObject[OBJECT_TOWER] = TR("Defense tower"); + stringsObject[OBJECT_NEST] = TR("Nest"); + stringsObject[OBJECT_RESEARCH] = TR("Research center"); + stringsObject[OBJECT_RADAR] = TR("Radar station"); + stringsObject[OBJECT_INFO] = TR("Information exchange post"); + stringsObject[OBJECT_ENERGY] = TR("Power cell factory"); + stringsObject[OBJECT_LABO] = TR("Autolab"); + stringsObject[OBJECT_NUCLEAR] = TR("Nuclear power station"); + stringsObject[OBJECT_PARA] = TR("Lightning conductor"); + stringsObject[OBJECT_SAFE] = TR("Vault"); + stringsObject[OBJECT_HUSTON] = TR("Houston Mission Control"); + stringsObject[OBJECT_TARGET1] = TR("Target"); + stringsObject[OBJECT_TARGET2] = TR("Target"); + stringsObject[OBJECT_START] = TR("Start"); + stringsObject[OBJECT_END] = TR("Finish"); + stringsObject[OBJECT_STONE] = TR("Titanium ore"); + stringsObject[OBJECT_URANIUM] = TR("Uranium ore"); + stringsObject[OBJECT_BULLET] = TR("Organic matter"); + stringsObject[OBJECT_METAL] = TR("Titanium"); + stringsObject[OBJECT_POWER] = TR("Power cell"); + stringsObject[OBJECT_ATOMIC] = TR("Nuclear power cell"); + stringsObject[OBJECT_BBOX] = TR("Black box"); + stringsObject[OBJECT_KEYa] = TR("Key A"); + stringsObject[OBJECT_KEYb] = TR("Key B"); + stringsObject[OBJECT_KEYc] = TR("Key C"); + stringsObject[OBJECT_KEYd] = TR("Key D"); + stringsObject[OBJECT_TNT] = TR("Explosive"); + stringsObject[OBJECT_BOMB] = TR("Fixed mine"); + stringsObject[OBJECT_BAG] = TR("Survival kit"); + stringsObject[OBJECT_WAYPOINT] = TR("Checkpoint"); + stringsObject[OBJECT_FLAGb] = TR("Blue flag"); + stringsObject[OBJECT_FLAGr] = TR("Red flag"); + stringsObject[OBJECT_FLAGg] = TR("Green flag"); + stringsObject[OBJECT_FLAGy] = TR("Yellow flag"); + stringsObject[OBJECT_FLAGv] = TR("Violet flag"); + stringsObject[OBJECT_MARKPOWER] = TR("Energy deposit (site for power station)"); + stringsObject[OBJECT_MARKURANIUM] = TR("Uranium deposit (site for derrick)"); + stringsObject[OBJECT_MARKKEYa] = TR("Found key A (site for derrick)"); + stringsObject[OBJECT_MARKKEYb] = TR("Found key B (site for derrick)"); + stringsObject[OBJECT_MARKKEYc] = TR("Found key C (site for derrick)"); + stringsObject[OBJECT_MARKKEYd] = TR("Found key D (site for derrick)"); + stringsObject[OBJECT_MARKSTONE] = TR("Titanium deposit (site for derrick)"); + stringsObject[OBJECT_MOBILEft] = TR("Practice bot"); + stringsObject[OBJECT_MOBILEtt] = TR("Practice bot"); + stringsObject[OBJECT_MOBILEwt] = TR("Practice bot"); + stringsObject[OBJECT_MOBILEit] = TR("Practice bot"); + stringsObject[OBJECT_MOBILEfa] = TR("Winged grabber"); + stringsObject[OBJECT_MOBILEta] = TR("Tracked grabber"); + stringsObject[OBJECT_MOBILEwa] = TR("Wheeled grabber"); + stringsObject[OBJECT_MOBILEia] = TR("Legged grabber"); + stringsObject[OBJECT_MOBILEfc] = TR("Winged shooter"); + stringsObject[OBJECT_MOBILEtc] = TR("Tracked shooter"); + stringsObject[OBJECT_MOBILEwc] = TR("Wheeled shooter"); + stringsObject[OBJECT_MOBILEic] = TR("Legged shooter"); + stringsObject[OBJECT_MOBILEfi] = TR("Winged orga shooter"); + stringsObject[OBJECT_MOBILEti] = TR("Tracked orga shooter"); + stringsObject[OBJECT_MOBILEwi] = TR("Wheeled orga shooter"); + stringsObject[OBJECT_MOBILEii] = TR("Legged orga shooter"); + stringsObject[OBJECT_MOBILEfs] = TR("Winged sniffer"); + stringsObject[OBJECT_MOBILEts] = TR("Tracked sniffer"); + stringsObject[OBJECT_MOBILEws] = TR("Wheeled sniffer"); + stringsObject[OBJECT_MOBILEis] = TR("Legged sniffer"); + stringsObject[OBJECT_MOBILErt] = TR("Thumper"); + stringsObject[OBJECT_MOBILErc] = TR("Phazer shooter"); + stringsObject[OBJECT_MOBILErr] = TR("Recycler"); + stringsObject[OBJECT_MOBILErs] = TR("Shielder"); + stringsObject[OBJECT_MOBILEsa] = TR("Subber"); + stringsObject[OBJECT_MOBILEtg] = TR("Target bot"); + stringsObject[OBJECT_MOBILEdr] = TR("Drawer bot"); + stringsObject[OBJECT_TECH] = TR("Engineer"); + stringsObject[OBJECT_TOTO] = TR("Robbie"); + stringsObject[OBJECT_MOTHER] = TR("Alien Queen"); + stringsObject[OBJECT_ANT] = TR("Ant"); + stringsObject[OBJECT_SPIDER] = TR("Spider"); + stringsObject[OBJECT_BEE] = TR("Wasp"); + stringsObject[OBJECT_WORM] = TR("Worm"); + stringsObject[OBJECT_EGG] = TR("Egg"); + stringsObject[OBJECT_RUINmobilew1] = TR("Wreckage"); + stringsObject[OBJECT_RUINmobilew2] = TR("Wreckage"); + stringsObject[OBJECT_RUINmobilet1] = TR("Wreckage"); + stringsObject[OBJECT_RUINmobilet2] = TR("Wreckage"); + stringsObject[OBJECT_RUINmobiler1] = TR("Wreckage"); + stringsObject[OBJECT_RUINmobiler2] = TR("Wreckage"); + stringsObject[OBJECT_RUINfactory] = TR("Ruin"); + stringsObject[OBJECT_RUINdoor] = TR("Ruin"); + stringsObject[OBJECT_RUINsupport] = TR("Waste"); + stringsObject[OBJECT_RUINradar] = TR("Ruin"); + stringsObject[OBJECT_RUINconvert] = TR("Ruin"); + stringsObject[OBJECT_RUINbase] = TR("Spaceship ruin"); + stringsObject[OBJECT_RUINhead] = TR("Spaceship ruin"); + stringsObject[OBJECT_APOLLO1] = TR("Remains of Apollo mission"); + stringsObject[OBJECT_APOLLO3] = TR("Remains of Apollo mission"); + stringsObject[OBJECT_APOLLO4] = TR("Remains of Apollo mission"); + stringsObject[OBJECT_APOLLO5] = TR("Remains of Apollo mission"); + stringsObject[OBJECT_APOLLO2] = TR("Lunar Roving Vehicle"); + + + + stringsErr[ERR_GENERIC] = TR("Internal error - tell the developers"); + stringsErr[ERR_CMD] = TR("Unknown command"); + stringsErr[ERR_MANIP_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_MANIP_FLY] = TR("Impossible when flying"); + stringsErr[ERR_MANIP_BUSY] = TR("Already carrying something"); + stringsErr[ERR_MANIP_NIL] = TR("Nothing to grab"); + stringsErr[ERR_MANIP_MOTOR] = TR("Impossible when moving"); + stringsErr[ERR_MANIP_OCC] = TR("Place occupied"); + stringsErr[ERR_MANIP_FRIEND] = TR("No other robot"); + stringsErr[ERR_MANIP_RADIO] = TR("You can not carry a radioactive object"); + stringsErr[ERR_MANIP_WATER] = TR("You can not carry an object under water"); + stringsErr[ERR_MANIP_EMPTY] = TR("Nothing to drop"); + stringsErr[ERR_BUILD_FLY] = TR("Impossible when flying"); + stringsErr[ERR_BUILD_WATER] = TR("Impossible under water"); + stringsErr[ERR_BUILD_ENERGY] = TR("Not enough energy"); + stringsErr[ERR_BUILD_METALAWAY] = TR("Titanium too far away"); + stringsErr[ERR_BUILD_METALNEAR] = TR("Titanium too close"); + stringsErr[ERR_BUILD_METALINEX] = TR("No titanium around"); + stringsErr[ERR_BUILD_FLAT] = TR("Ground not flat enough"); + stringsErr[ERR_BUILD_FLATLIT] = TR("Flat ground not large enough"); + stringsErr[ERR_BUILD_BUSY] = TR("Place occupied"); + stringsErr[ERR_BUILD_BASE] = TR("Too close to space ship"); + stringsErr[ERR_BUILD_NARROW] = TR("Too close to a building"); + stringsErr[ERR_BUILD_MOTOR] = TR("Impossible when moving"); + stringsErr[ERR_SEARCH_FLY] = TR("Impossible when flying"); + stringsErr[ERR_BUILD_DISABLED] = TR("Can not produce this object in this mission"); + stringsErr[ERR_BUILD_RESEARCH] = TR("Can not produce not researched object"); + stringsErr[ERR_SEARCH_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_SEARCH_MOTOR] = TR("Impossible when moving"); + stringsErr[ERR_TERRA_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_TERRA_ENERGY] = TR("Not enough energy"); + stringsErr[ERR_TERRA_FLOOR] = TR("Ground inappropriate"); + stringsErr[ERR_TERRA_BUILDING] = TR("Building too close"); + stringsErr[ERR_TERRA_OBJECT] = TR("Object too close"); + stringsErr[ERR_RECOVER_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_RECOVER_ENERGY] = TR("Not enough energy"); + stringsErr[ERR_RECOVER_NULL] = TR("Nothing to recycle"); + stringsErr[ERR_SHIELD_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_SHIELD_ENERGY] = TR("No more energy"); + stringsErr[ERR_MOVE_IMPOSSIBLE] = TR("Error in instruction move"); + stringsErr[ERR_FIND_IMPOSSIBLE] = TR("Object not found"); + stringsErr[ERR_GOTO_IMPOSSIBLE] = TR("Goto: inaccessible destination"); + stringsErr[ERR_GOTO_ITER] = TR("Goto: inaccessible destination"); + stringsErr[ERR_GOTO_BUSY] = TR("Goto: destination occupied"); + stringsErr[ERR_FIRE_VEH] = TR("Inappropriate bot"); + stringsErr[ERR_FIRE_ENERGY] = TR("Not enough energy"); + stringsErr[ERR_FIRE_FLY] = TR("Impossible when flying"); + stringsErr[ERR_CONVERT_EMPTY] = TR("No titanium ore to convert"); + stringsErr[ERR_DERRICK_NULL] = TR("No ore in the subsoil"); + stringsErr[ERR_STATION_NULL] = TR("No energy in the subsoil"); + stringsErr[ERR_TOWER_POWER] = TR("No power cell"); + stringsErr[ERR_TOWER_ENERGY] = TR("No more energy"); + stringsErr[ERR_RESEARCH_POWER] = TR("No power cell"); + stringsErr[ERR_RESEARCH_ENERGY] = TR("Not enough energy"); + stringsErr[ERR_RESEARCH_TYPE] = TR("Inappropriate cell type"); + stringsErr[ERR_RESEARCH_ALREADY]= TR("Research program already performed"); + stringsErr[ERR_ENERGY_NULL] = TR("No energy in the subsoil"); + stringsErr[ERR_ENERGY_LOW] = TR("Not enough energy yet"); + stringsErr[ERR_ENERGY_EMPTY] = TR("No titanium to transform"); + stringsErr[ERR_ENERGY_BAD] = TR("Transforms only titanium"); + stringsErr[ERR_BASE_DLOCK] = TR("Doors blocked by a robot or another object "); + stringsErr[ERR_BASE_DHUMAN] = TR("You must get on the spaceship to take off "); + stringsErr[ERR_LABO_NULL] = TR("Nothing to analyze"); + stringsErr[ERR_LABO_BAD] = TR("Analyzes only organic matter"); + stringsErr[ERR_LABO_ALREADY] = TR("Analysis already performed"); + stringsErr[ERR_NUCLEAR_NULL] = TR("No energy in the subsoil"); + stringsErr[ERR_NUCLEAR_LOW] = TR("Not yet enough energy"); + stringsErr[ERR_NUCLEAR_EMPTY] = TR("No uranium to transform"); + stringsErr[ERR_NUCLEAR_BAD] = TR("Transforms only uranium"); + stringsErr[ERR_FACTORY_NULL] = TR("No titanium"); + stringsErr[ERR_FACTORY_NEAR] = TR("Object too close"); + stringsErr[ERR_RESET_NEAR] = TR("Place occupied"); + stringsErr[ERR_INFO_NULL] = TR("No information exchange post within range"); + stringsErr[ERR_VEH_VIRUS] = TR("Program infected by a virus"); + stringsErr[ERR_BAT_VIRUS] = TR("Infected by a virus; temporarily out of order"); + stringsErr[ERR_VEH_POWER] = TR("No power cell"); + stringsErr[ERR_VEH_ENERGY] = TR("No more energy"); + stringsErr[ERR_FLAG_FLY] = TR("Impossible when flying"); + stringsErr[ERR_FLAG_WATER] = TR("Impossible when swimming"); + stringsErr[ERR_FLAG_MOTOR] = TR("Impossible when moving"); + stringsErr[ERR_FLAG_BUSY] = TR("Impossible when carrying an object"); + stringsErr[ERR_FLAG_CREATE] = TR("Too many flags of this color (maximum 5)"); + stringsErr[ERR_FLAG_PROXY] = TR("Too close to an existing flag"); + stringsErr[ERR_FLAG_DELETE] = TR("No flag nearby"); + stringsErr[ERR_DESTROY_NOTFOUND]= TR("Not found anything to destroy"); + stringsErr[ERR_WRONG_OBJ] = TR("Inappropriate object"); + stringsErr[ERR_MISSION_NOTERM] = TR("The mission is not accomplished yet (press \\key help; for more details)"); + stringsErr[ERR_DELETEMOBILE] = TR("Bot destroyed"); + stringsErr[ERR_DELETEBUILDING] = TR("Building destroyed"); + stringsErr[ERR_TOOMANY] = TR("Can not create this; there are too many objects"); + stringsErr[ERR_OBLIGATORYTOKEN] = TR("\"%s\" missing in this exercise"); + stringsErr[ERR_PROHIBITEDTOKEN] = TR("Do not use in this exercise"); + + stringsErr[INFO_BUILD] = TR("Building completed"); + stringsErr[INFO_CONVERT] = TR("Titanium available"); + stringsErr[INFO_RESEARCH] = TR("Research program completed"); + stringsErr[INFO_RESEARCHTANK] = TR("Plans for tracked robots available "); + stringsErr[INFO_RESEARCHFLY] = TR("You can fly with the keys (\\key gup;) and (\\key gdown;)"); + stringsErr[INFO_RESEARCHTHUMP] = TR("Plans for thumper available"); + stringsErr[INFO_RESEARCHCANON] = TR("Plans for shooter available"); + stringsErr[INFO_RESEARCHTOWER] = TR("Plans for defense tower available"); + stringsErr[INFO_RESEARCHPHAZER] = TR("Plans for phazer shooter available"); + stringsErr[INFO_RESEARCHSHIELD] = TR("Plans for shielder available"); + stringsErr[INFO_RESEARCHATOMIC] = TR("Plans for nuclear power plant available"); + stringsErr[INFO_FACTORY] = TR("New bot available"); + stringsErr[INFO_LABO] = TR("Analysis performed"); + stringsErr[INFO_ENERGY] = TR("Power cell available"); + stringsErr[INFO_NUCLEAR] = TR("Nuclear power cell available"); + stringsErr[INFO_FINDING] = TR("You found a usable object"); + stringsErr[INFO_MARKPOWER] = TR("Found a site for power station"); + stringsErr[INFO_MARKURANIUM] = TR("Found a site for a derrick"); + stringsErr[INFO_MARKSTONE] = TR("Found a site for a derrick"); + stringsErr[INFO_MARKKEYa] = TR("Found a site for a derrick"); + stringsErr[INFO_MARKKEYb] = TR("Found a site for a derrick"); + stringsErr[INFO_MARKKEYc] = TR("Found a site for a derrick"); + stringsErr[INFO_MARKKEYd] = TR("Found a site for a derrick"); + stringsErr[INFO_WIN] = TR("<<< Well done; mission accomplished >>>"); + stringsErr[INFO_LOST] = TR("<<< Sorry; mission failed >>>"); + stringsErr[INFO_LOSTq] = TR("<<< Sorry; mission failed >>>"); + stringsErr[INFO_WRITEOK] = TR("Current mission saved"); + stringsErr[INFO_DELETEPATH] = TR("Checkpoint crossed"); + stringsErr[INFO_DELETEMOTHER] = TR("Alien Queen killed"); + stringsErr[INFO_DELETEANT] = TR("Ant fatally wounded"); + stringsErr[INFO_DELETEBEE] = TR("Wasp fatally wounded"); + stringsErr[INFO_DELETEWORM] = TR("Worm fatally wounded"); + stringsErr[INFO_DELETESPIDER] = TR("Spider fatally wounded"); + stringsErr[INFO_BEGINSATCOM] = TR("Press \\key help; to read instructions on your SatCom"); + + + + stringsCbot[TX_OPENPAR] = TR("Opening bracket missing"); + stringsCbot[TX_CLOSEPAR] = TR("Closing bracket missing "); + stringsCbot[TX_NOTBOOL] = TR("The expression must return a boolean value"); + stringsCbot[TX_UNDEFVAR] = TR("Variable not declared"); + stringsCbot[TX_BADLEFT] = TR("Assignment impossible"); + stringsCbot[TX_ENDOF] = TR("Semicolon terminator missing"); + stringsCbot[TX_OUTCASE] = TR("Instruction \"case\" outside a block \"switch\""); + stringsCbot[TX_NOTERM] = TR("Instructions after the final closing brace"); + stringsCbot[TX_CLOSEBLK] = TR("End of block missing"); + stringsCbot[TX_ELSEWITHOUTIF] = TR("Instruction \"else\" without corresponding \"if\" "); + stringsCbot[TX_OPENBLK] = TR("Opening brace missing "); + stringsCbot[TX_BADTYPE] = TR("Wrong type for the assignment"); + stringsCbot[TX_REDEFVAR] = TR("A variable can not be declared twice"); + stringsCbot[TX_BAD2TYPE] = TR("The types of the two operands are incompatible "); + stringsCbot[TX_UNDEFCALL] = TR("Unknown function"); + stringsCbot[TX_MISDOTS] = TR("Sign \" : \" missing"); + stringsCbot[TX_WHILE] = TR("Keyword \"while\" missing"); + stringsCbot[TX_BREAK] = TR("Instruction \"break\" outside a loop"); + stringsCbot[TX_LABEL] = TR("A label must be followed by \"for\"; \"while\"; \"do\" or \"switch\""); + stringsCbot[TX_NOLABEL] = TR("This label does not exist"); + stringsCbot[TX_NOCASE] = TR("Instruction \"case\" missing"); + stringsCbot[TX_BADNUM] = TR("Number missing"); + stringsCbot[TX_VOID] = TR("Void parameter"); + stringsCbot[TX_NOTYP] = TR("Type declaration missing"); + stringsCbot[TX_NOVAR] = TR("Variable name missing"); + stringsCbot[TX_NOFONC] = TR("Function name missing"); + stringsCbot[TX_OVERPARAM] = TR("Too many parameters"); + stringsCbot[TX_REDEF] = TR("Function already exists"); + stringsCbot[TX_LOWPARAM] = TR("Parameters missing "); + stringsCbot[TX_BADPARAM] = TR("No function with this name accepts this kind of parameter"); + stringsCbot[TX_NUMPARAM] = TR("No function with this name accepts this number of parameters"); + stringsCbot[TX_NOITEM] = TR("This is not a member of this class"); + stringsCbot[TX_DOT] = TR("This object is not a member of a class"); + stringsCbot[TX_NOCONST] = TR("Appropriate constructor missing"); + stringsCbot[TX_REDEFCLASS] = TR("This class already exists"); + stringsCbot[TX_CLBRK] = TR("\" ] \" missing"); + stringsCbot[TX_RESERVED] = TR("Reserved keyword of CBOT language"); + stringsCbot[TX_BADNEW] = TR("Bad argument for \"new\""); + stringsCbot[TX_OPBRK] = TR("\" [ \" expected"); + stringsCbot[TX_BADSTRING] = TR("String missing"); + stringsCbot[TX_BADINDEX] = TR("Incorrect index type"); + stringsCbot[TX_PRIVATE] = TR("Private element"); + stringsCbot[TX_NOPUBLIC] = TR("Public required"); + stringsCbot[TX_DIVZERO] = TR("Dividing by zero"); + stringsCbot[TX_NOTINIT] = TR("Variable not initialized"); + stringsCbot[TX_BADTHROW] = TR("Negative value rejected by \"throw\""); + stringsCbot[TX_NORETVAL] = TR("The function returned no value "); + stringsCbot[TX_NORUN] = TR("No function running"); + stringsCbot[TX_NOCALL] = TR("Calling an unknown function"); + stringsCbot[TX_NOCLASS] = TR("This class does not exist"); + stringsCbot[TX_NULLPT] = TR("Unknown Object"); + stringsCbot[TX_OPNAN] = TR("Operation impossible with value \"nan\""); + stringsCbot[TX_OUTARRAY] = TR("Access beyond array limit"); + stringsCbot[TX_STACKOVER] = TR("Stack overflow"); + stringsCbot[TX_DELETEDPT] = TR("Illegal object"); + stringsCbot[TX_FILEOPEN] = TR("Can't open file"); + stringsCbot[TX_NOTOPEN] = TR("File not open"); + stringsCbot[TX_ERRREAD] = TR("Read error"); + stringsCbot[TX_ERRWRITE] = TR("Write error"); } diff --git a/src/common/restext.h b/src/common/restext.h index cde7203..8eb6bdb 100644 --- a/src/common/restext.h +++ b/src/common/restext.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/restext.h @@ -72,7 +75,6 @@ enum ResTextType RT_TITLE_WRITE = 50, RT_TITLE_READ = 51, RT_TITLE_USER = 52, - RT_TITLE_TEEN = 53, RT_PLAY_CHAPt = 60, RT_PLAY_CHAPd = 61, @@ -86,7 +88,6 @@ enum ResTextType RT_PLAY_CHAPu = 71, RT_PLAY_LISTu = 72, RT_PLAY_CHAPte = 73, - RT_PLAY_LISTk = 74, RT_SETUP_DEVICE = 80, RT_SETUP_MODE = 81, diff --git a/src/common/singleton.h b/src/common/singleton.h index 841759d..eab7ec5 100644 --- a/src/common/singleton.h +++ b/src/common/singleton.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/singleton.h @@ -62,10 +65,7 @@ public: static void ReplaceInstance(T* newInstance) { assert(newInstance != nullptr); - - if (m_instance != nullptr) - delete m_instance; - + delete m_instance; m_instance = newInstance; } #endif diff --git a/src/common/stringutils.cpp b/src/common/stringutils.cpp index 03a0f0b..9edc82d 100644 --- a/src/common/stringutils.cpp +++ b/src/common/stringutils.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/stringutils.h" diff --git a/src/common/stringutils.h b/src/common/stringutils.h index e80163a..46c1d2a 100644 --- a/src/common/stringutils.h +++ b/src/common/stringutils.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file common/stringutils.h diff --git a/src/graphics/core/color.cpp b/src/graphics/core/color.cpp index f0b74f8..d51eb1a 100644 --- a/src/graphics/core/color.cpp +++ b/src/graphics/core/color.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/core/color.h" diff --git a/src/graphics/core/color.h b/src/graphics/core/color.h index 87a50f4..d73b47e 100644 --- a/src/graphics/core/color.h +++ b/src/graphics/core/color.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/color.h diff --git a/src/graphics/core/device.h b/src/graphics/core/device.h index a896104..f52e07f 100644 --- a/src/graphics/core/device.h +++ b/src/graphics/core/device.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/device.h @@ -258,26 +260,16 @@ public: //! Sets the transform matrix of given type virtual void SetTransform(TransformType type, const Math::Matrix &matrix) = 0; - //! Returns the current transform matrix of given type - virtual const Math::Matrix& GetTransform(TransformType type) = 0; - //! Multiplies the current transform matrix of given type by given matrix - virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix) = 0; //! Sets the current material virtual void SetMaterial(const Material &material) = 0; - //! Returns the current material - virtual const Material& GetMaterial() = 0; //! Returns the maximum number of lights available virtual int GetMaxLightCount() = 0; //! Sets the light at given index virtual void SetLight(int index, const Light &light) = 0; - //! Returns the current light at given index - virtual const Light& GetLight(int index) = 0; //! Enables/disables the light at given index virtual void SetLightEnabled(int index, bool enabled) = 0; - //! Returns the current enable state of light at given index - virtual bool GetLightEnabled(int index) = 0; //! Creates a texture from image; the image can be safely removed after that virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) = 0; @@ -294,17 +286,11 @@ public: virtual void SetTexture(int index, const Texture &texture) = 0; //! Sets the texture image by ID at given texture stage virtual void SetTexture(int index, unsigned int textureId) = 0; - //! Returns the (multi)texture at given index - virtual Texture GetTexture(int index) = 0; //! Enables/disables the given texture stage virtual void SetTextureEnabled(int index, bool enabled) = 0; - //! Returns the current enable state of given texture stage - virtual bool GetTextureEnabled(int index) = 0; //! Sets the params for texture stage with given index virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms) = 0; - //! Returns the current params of texture stage with given index - virtual TextureStageParams GetTextureStageParams(int index) = 0; //! Sets only the texture wrap modes (for faster than thru stage params) virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT) = 0; @@ -348,61 +334,39 @@ public: //! Enables/disables the given render state virtual void SetRenderState(RenderState state, bool enabled) = 0; - //! Returns the current setting of given render state - virtual bool GetRenderState(RenderState state) = 0; //! Sets the function of depth test virtual void SetDepthTestFunc(CompFunc func) = 0; - //! Returns the current function of depth test - virtual CompFunc GetDepthTestFunc() = 0; //! Sets the depth bias (constant value added to Z-coords) virtual void SetDepthBias(float factor) = 0; - //! Returns the current depth bias - virtual float GetDepthBias() = 0; //! Sets the alpha test function and reference value virtual void SetAlphaTestFunc(CompFunc func, float refValue) = 0; - //! Returns the current alpha test function and reference value - virtual void GetAlphaTestFunc(CompFunc &func, float &refValue) = 0; //! Sets the blending functions for source and destination operations virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) = 0; - //! Returns the current blending functions for source and destination operations - virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend) = 0; //! Sets the clear color virtual void SetClearColor(const Color &color) = 0; - //! Returns the current clear color - virtual Color GetClearColor() = 0; //! Sets the global ambient color virtual void SetGlobalAmbient(const Color &color) = 0; - //! Returns the global ambient color - virtual Color GetGlobalAmbient() = 0; //! Sets the fog parameters: mode, color, start distance, end distance and density (for exp models) virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) = 0; - //! Returns the current fog parameters: mode, color, start distance, end distance and density (for exp models) - virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density) = 0; //! Sets the current cull mode virtual void SetCullMode(CullMode mode) = 0; - //! Returns the current cull mode - virtual CullMode GetCullMode() = 0; //! Sets the shade model virtual void SetShadeModel(ShadeModel model) = 0; - //! Returns the current shade model - virtual ShadeModel GetShadeModel() = 0; //! Sets the current fill mode virtual void SetFillMode(FillMode mode) = 0; - //! Returns the current fill mode - virtual FillMode GetFillMode() = 0; //! Returns the pixels of the entire screen - virtual void* GetFrameBufferPixels()const = 0; + virtual void* GetFrameBufferPixels() const = 0; }; diff --git a/src/graphics/core/light.h b/src/graphics/core/light.h index 923d0e9..e8eda7b 100644 --- a/src/graphics/core/light.h +++ b/src/graphics/core/light.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/light.h diff --git a/src/graphics/core/material.h b/src/graphics/core/material.h index e0bfaff..1fde860 100644 --- a/src/graphics/core/material.h +++ b/src/graphics/core/material.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/material.h diff --git a/src/graphics/core/texture.h b/src/graphics/core/texture.h index 0702428..3ce06ee 100644 --- a/src/graphics/core/texture.h +++ b/src/graphics/core/texture.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/texture.h diff --git a/src/graphics/core/vertex.h b/src/graphics/core/vertex.h index ca68352..7af7212 100644 --- a/src/graphics/core/vertex.h +++ b/src/graphics/core/vertex.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/core/vertex.h diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp index c37ed39..6464b22 100644 --- a/src/graphics/engine/camera.cpp +++ b/src/graphics/engine/camera.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/camera.h" diff --git a/src/graphics/engine/camera.h b/src/graphics/engine/camera.h index 699593c..4fe821f 100644 --- a/src/graphics/engine/camera.h +++ b/src/graphics/engine/camera.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/camera.h diff --git a/src/graphics/engine/cloud.cpp b/src/graphics/engine/cloud.cpp index 74083af..7ec0d9e 100644 --- a/src/graphics/engine/cloud.cpp +++ b/src/graphics/engine/cloud.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/cloud.h" @@ -125,8 +127,8 @@ void CCloud::Draw() material.ambient = m_ambient; m_engine->SetMaterial(material); - m_engine->SetTexture(m_fileName, 0); - m_engine->SetTexture(m_fileName, 1); + m_engine->SetTexture("textures/"+m_fileName, 0); + m_engine->SetTexture("textures/"+m_fileName, 1); m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_FOG | ENG_RSTATE_WRAP); @@ -218,7 +220,7 @@ void CCloud::Create(const std::string& fileName, m_fileName = fileName; if (! m_fileName.empty()) - m_engine->LoadTexture(m_fileName); + m_engine->LoadTexture("textures/"+m_fileName); if (m_terrain == nullptr) m_terrain = CRobotMain::GetInstancePointer()->GetTerrain(); diff --git a/src/graphics/engine/cloud.h b/src/graphics/engine/cloud.h index 8e820c7..decf1d6 100644 --- a/src/graphics/engine/cloud.h +++ b/src/graphics/engine/cloud.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/cloud.h diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index e0861d2..db702b7 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -1,25 +1,26 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/engine.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/key.h" @@ -283,7 +284,7 @@ bool CEngine::Create() params.minFilter = TEX_MIN_FILTER_NEAREST; params.magFilter = TEX_MAG_FILTER_NEAREST; params.mipmap = false; - m_miceTexture = LoadTexture("mouse.png", params); + m_miceTexture = LoadTexture("textures/interface/mouse.png", params); GetSystemUtils()->GetCurrentTimeStamp(m_currentFrameTime); GetSystemUtils()->GetCurrentTimeStamp(m_lastFrameTime); @@ -319,7 +320,7 @@ void CEngine::Destroy() void CEngine::ResetAfterDeviceChanged() { - m_size = m_app->GetVideoConfig().size;; + m_size = m_app->GetVideoConfig().size; m_text->FlushCache(); @@ -1124,10 +1125,10 @@ void CEngine::ChangeSecondTexture(int objRank, const std::string& tex2Name) p1.next[l2].next.clear(); if (!newP2.tex1.Valid()) - newP2.tex1 = LoadTexture(newP2.tex1Name); + newP2.tex1 = LoadTexture("textures/"+newP2.tex1Name); if (!newP2.tex2.Valid()) - newP2.tex2 = LoadTexture(newP2.tex2Name); + newP2.tex2 = LoadTexture("textures/"+newP2.tex2Name); } } @@ -1965,10 +1966,10 @@ bool CEngine::IsWithinLODLimit(float distance, LODLevel lodLevel) } min *= m_size.x / 640.0f; - min *= m_objectDetail*2.0f; + min *= 1.0f+m_objectDetail*2.0f; max *= m_size.x / 640.0f; - max *= m_objectDetail*2.0f; + max *= 1.0f+m_objectDetail*2.0f; } return distance >= min && distance < max; @@ -2258,7 +2259,7 @@ Texture CEngine::CreateTexture(const std::string& texName, const TextureCreatePa if (image == nullptr) { - if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName))) + if (!img.Load(texName)) { std::string error = img.GetError(); GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str()); @@ -2309,27 +2310,27 @@ Texture CEngine::LoadTexture(const std::string& name, const TextureCreateParams& bool CEngine::LoadAllTextures() { - LoadTexture("text.png"); - m_miceTexture = LoadTexture("mouse.png"); - LoadTexture("button1.png"); - LoadTexture("button2.png"); - LoadTexture("button3.png"); - LoadTexture("effect00.png"); - LoadTexture("effect01.png"); - LoadTexture("effect02.png"); - LoadTexture("map.png"); + LoadTexture("textures/interface/text.png"); + m_miceTexture = LoadTexture("textures/interface/mouse.png"); + LoadTexture("textures/interface/button1.png"); + LoadTexture("textures/interface/button2.png"); + LoadTexture("textures/interface/button3.png"); + LoadTexture("textures/effect00.png"); + LoadTexture("textures/effect01.png"); + LoadTexture("textures/effect02.png"); + LoadTexture("textures/interface/map.png"); if (! m_backgroundName.empty()) { TextureCreateParams params = m_defaultTexParams; params.padToNearestPowerOfTwo = true; - m_backgroundTex = LoadTexture(m_backgroundName, params); + m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params); } else m_backgroundTex.SetInvalid(); if (! m_foregroundName.empty()) - m_foregroundTex = LoadTexture(m_foregroundName); + m_foregroundTex = LoadTexture("textures/"+m_foregroundName); else m_foregroundTex.SetInvalid(); @@ -2363,9 +2364,9 @@ bool CEngine::LoadAllTextures() if (! p2.tex1Name.empty()) { if (terrain) - p2.tex1 = LoadTexture(p2.tex1Name, m_terrainTexParams); + p2.tex1 = LoadTexture("textures/"+p2.tex1Name, m_terrainTexParams); else - p2.tex1 = LoadTexture(p2.tex1Name); + p2.tex1 = LoadTexture("textures/"+p2.tex1Name); if (! p2.tex1.Valid()) ok = false; @@ -2374,9 +2375,9 @@ bool CEngine::LoadAllTextures() if (! p2.tex2Name.empty()) { if (terrain) - p2.tex2 = LoadTexture(p2.tex2Name, m_terrainTexParams); + p2.tex2 = LoadTexture("textures/"+p2.tex2Name, m_terrainTexParams); else - p2.tex2 = LoadTexture(p2.tex2Name); + p2.tex2 = LoadTexture("textures/"+p2.tex2Name); if (! p2.tex2.Valid()) ok = false; @@ -2426,7 +2427,7 @@ bool CEngine::ChangeTextureColor(const std::string& texName, CImage img; - if (! img.Load(CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, texName))) + if (!img.Load(texName)) { std::string error = img.GetError(); GetLogger()->Error("Couldn't load texture '%s': %s, blacklisting\n", texName.c_str(), error.c_str()); @@ -2771,7 +2772,7 @@ void CEngine::SetBackground(const std::string& name, Color up, Color down, { TextureCreateParams params = m_defaultTexParams; params.padToNearestPowerOfTwo = true; - m_backgroundTex = LoadTexture(m_backgroundName, params); + m_backgroundTex = LoadTexture("textures/"+m_backgroundName, params); } } @@ -2797,7 +2798,7 @@ void CEngine::SetForegroundName(const std::string& name) m_foregroundName = name; if (! m_foregroundName.empty()) - m_foregroundTex = LoadTexture(m_foregroundName); + m_foregroundTex = LoadTexture("textures/"+m_foregroundName); } void CEngine::SetOverFront(bool front) @@ -3124,67 +3125,67 @@ void CEngine::Draw3DScene() m_app->StartPerformanceCounter(PCNT_RENDER_TERRAIN); - // Draw terrain with shadows, if shadows enabled - if (m_shadowVisible) + // Draw terrain + + m_lightMan->UpdateDeviceLights(ENG_OBJTYPE_TERRAIN); + + for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++) { - m_lightMan->UpdateDeviceLights(ENG_OBJTYPE_TERRAIN); + if (! m_objects[objRank].used) + continue; - for (int objRank = 0; objRank < static_cast<int>(m_objects.size()); objRank++) - { - if (! m_objects[objRank].used) - continue; + if (m_objects[objRank].type != ENG_OBJTYPE_TERRAIN) + continue; - if (m_objects[objRank].type != ENG_OBJTYPE_TERRAIN) - continue; + if (! m_objects[objRank].drawWorld) + continue; - if (! m_objects[objRank].drawWorld) - continue; + m_device->SetTransform(TRANSFORM_WORLD, m_objects[objRank].transform); - m_device->SetTransform(TRANSFORM_WORLD, m_objects[objRank].transform); + if (! IsVisible(objRank)) + continue; - if (! IsVisible(objRank)) - continue; + int baseObjRank = m_objects[objRank].baseObjRank; + if (baseObjRank == -1) + continue; - int baseObjRank = m_objects[objRank].baseObjRank; - if (baseObjRank == -1) - continue; + assert(baseObjRank >= 0 && baseObjRank < static_cast<int>( m_baseObjects.size() )); - assert(baseObjRank >= 0 && baseObjRank < static_cast<int>( m_baseObjects.size() )); + EngineBaseObject& p1 = m_baseObjects[baseObjRank]; + if (! p1.used) + continue; - EngineBaseObject& p1 = m_baseObjects[baseObjRank]; - if (! p1.used) - continue; + for (int l2 = 0; l2 < static_cast<int>( p1.next.size() ); l2++) + { + EngineBaseObjTexTier& p2 = p1.next[l2]; - for (int l2 = 0; l2 < static_cast<int>( p1.next.size() ); l2++) + SetTexture(p2.tex1, 0); + SetTexture(p2.tex2, 1); + + for (int l3 = 0; l3 < static_cast<int>( p2.next.size() ); l3++) { - EngineBaseObjTexTier& p2 = p1.next[l2]; + EngineBaseObjLODTier& p3 = p2.next[l3]; - SetTexture(p2.tex1, 0); - SetTexture(p2.tex2, 1); + if (! IsWithinLODLimit(m_objects[objRank].distance, p3.lodLevel)) + continue; - for (int l3 = 0; l3 < static_cast<int>( p2.next.size() ); l3++) + for (int l4 = 0; l4 < static_cast<int>( p3.next.size() ); l4++) { - EngineBaseObjLODTier& p3 = p2.next[l3]; - - if (! IsWithinLODLimit(m_objects[objRank].distance, p3.lodLevel)) - continue; - - for (int l4 = 0; l4 < static_cast<int>( p3.next.size() ); l4++) - { - EngineBaseObjDataTier& p4 = p3.next[l4]; + EngineBaseObjDataTier& p4 = p3.next[l4]; - SetMaterial(p4.material); - SetState(p4.state); + SetMaterial(p4.material); + SetState(p4.state); - DrawObject(p4); - } + DrawObject(p4); } } } + } - // Draws the shadows + // Draws the shadows , if shadows enabled + if (m_shadowVisible) DrawShadow(); - } + m_app->StopPerformanceCounter(PCNT_RENDER_TERRAIN); @@ -3736,7 +3737,7 @@ void CEngine::UpdateGroundSpotTextures() } std::stringstream str; - str << "shadow" << std::setfill('0') << std::setw(2) << s << ".png"; + str << "textures/shadow" << std::setfill('0') << std::setw(2) << s << ".png"; std::string texName = str.str(); DeleteTexture(texName); @@ -3785,7 +3786,7 @@ void CEngine::DrawShadow() SetMaterial(material); // TODO: create a separate texture - SetTexture("text.png"); + SetTexture("textures/interface/text.png"); Math::Point ts, ti; diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index d56bf38..a4d0152 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX& EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/engine.h diff --git a/src/graphics/engine/lightman.cpp b/src/graphics/engine/lightman.cpp index 564cced..bb67ad0 100644 --- a/src/graphics/engine/lightman.cpp +++ b/src/graphics/engine/lightman.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/lightman.h" diff --git a/src/graphics/engine/lightman.h b/src/graphics/engine/lightman.h index 5df466d..d8f32bb 100644 --- a/src/graphics/engine/lightman.h +++ b/src/graphics/engine/lightman.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/lightman.h diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp index 4395eec..be76b2f 100644 --- a/src/graphics/engine/lightning.cpp +++ b/src/graphics/engine/lightning.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/lightning.h" @@ -235,7 +237,7 @@ void CLightning::Draw() mat.LoadIdentity(); device->SetTransform(TRANSFORM_WORLD, mat); - m_engine->SetTexture("effect00.png"); + m_engine->SetTexture("textures/effect00.png"); m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK); Math::Point texInf; diff --git a/src/graphics/engine/lightning.h b/src/graphics/engine/lightning.h index 1b1d339..3426515 100644 --- a/src/graphics/engine/lightning.h +++ b/src/graphics/engine/lightning.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/lightning.h diff --git a/src/graphics/engine/modelfile.cpp b/src/graphics/engine/modelfile.cpp index 99496aa..09c7bbd 100644 --- a/src/graphics/engine/modelfile.cpp +++ b/src/graphics/engine/modelfile.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/modelfile.h" @@ -22,6 +24,8 @@ #include "common/logger.h" #include "common/stringutils.h" +#include "common/resources/inputstream.h" + #include "graphics/engine/engine.h" #include "math/geometry.h" @@ -432,9 +436,9 @@ bool CModelFile::ReadModel(const std::string& fileName) { m_triangles.clear(); - std::ifstream stream; - stream.open(fileName.c_str(), std::ios_base::in | std::ios_base::binary); - if (!stream.good()) + CInputStream stream; + stream.open(fileName.c_str()); + if (!stream.is_open()) { GetLogger()->Error("Could not open file '%s'\n", fileName.c_str()); return false; @@ -823,9 +827,9 @@ struct NewModelTriangle1 bool CModelFile::ReadTextModel(const std::string& fileName) { - std::ifstream stream; - stream.open(fileName.c_str(), std::ios_base::in); - if (!stream.good()) + CInputStream stream; + stream.open(fileName.c_str()); + if (!stream.is_open()) { GetLogger()->Error("Could not open file '%s'\n", fileName.c_str()); return false; @@ -1020,9 +1024,9 @@ bool CModelFile::WriteTextModel(std::ostream& stream) bool CModelFile::ReadBinaryModel(const std::string& fileName) { - std::ifstream stream; - stream.open(fileName.c_str(), std::ios_base::in | std::ios_base::binary); - if (!stream.good()) + CInputStream stream; + stream.open(fileName.c_str()); + if (!stream.is_open()) { GetLogger()->Error("Could not open file '%s'\n", fileName.c_str()); return false; diff --git a/src/graphics/engine/modelfile.h b/src/graphics/engine/modelfile.h index 3b4019b..f6ac229 100644 --- a/src/graphics/engine/modelfile.h +++ b/src/graphics/engine/modelfile.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/modelfile.h diff --git a/src/graphics/engine/modelmanager.cpp b/src/graphics/engine/modelmanager.cpp index 0c0fb98..ec104d0 100644 --- a/src/graphics/engine/modelmanager.cpp +++ b/src/graphics/engine/modelmanager.cpp @@ -1,24 +1,25 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012-2014, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/modelmanager.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/logger.h" @@ -48,11 +49,9 @@ bool CModelManager::LoadModel(const std::string& fileName, bool mirrored) if (CApplication::GetInstance().IsDebugModeActive(DEBUG_MODELS)) modelFile.SetPrintDebugInfo(true); - std::string filePath = CGameData::GetInstancePointer()->GetFilePath(DIR_MODEL, fileName); - - if (!modelFile.ReadModel(filePath)) + if (!modelFile.ReadModel("models/" + fileName)) { - GetLogger()->Error("Loading model '%s' failed\n", filePath.c_str()); + GetLogger()->Error("Loading model '%s' failed\n", fileName.c_str()); return false; } diff --git a/src/graphics/engine/modelmanager.h b/src/graphics/engine/modelmanager.h index ee5fc27..3805631 100644 --- a/src/graphics/engine/modelmanager.h +++ b/src/graphics/engine/modelmanager.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012-2014, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #pragma once diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp index abee2e2..d038322 100644 --- a/src/graphics/engine/particle.cpp +++ b/src/graphics/engine/particle.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/particle.h" @@ -201,7 +203,7 @@ void NameParticle(std::string &name, int num) if (num == 1) name = "effect00.png"; else if (num == 2) name = "effect01.png"; else if (num == 3) name = "effect02.png"; - else if (num == 4) name = "text.png"; + else if (num == 4) name = "interface/text.png"; else name = ""; } @@ -3532,7 +3534,7 @@ void CParticle::DrawParticle(int sheet) if (m_particle[i].sheet != sheet) continue; if (m_particle[i].type == PARTIPART) continue; - m_engine->SetTexture(m_triangle[i].tex1Name); + m_engine->SetTexture("textures/"+m_triangle[i].tex1Name); m_engine->SetMaterial(m_triangle[i].material); m_engine->SetState(m_triangle[i].state); DrawParticleTriangle(i); @@ -3551,7 +3553,7 @@ void CParticle::DrawParticle(int sheet) // Draw tire marks. if (m_wheelTraceTotal > 0 && sheet == SH_WORLD) { - m_engine->SetTexture("text.png"); + m_engine->SetTexture("textures/interface/text.png"); m_engine->SetState(ENG_RSTATE_TTEXTURE_WHITE); Math::Matrix matrix; matrix.LoadIdentity(); @@ -3582,7 +3584,7 @@ void CParticle::DrawParticle(int sheet) { std::string name; NameParticle(name, t); - m_engine->SetTexture(name); + m_engine->SetTexture("textures/"+name); loadTexture = true; } diff --git a/src/graphics/engine/particle.h b/src/graphics/engine/particle.h index 7fb24a1..c7c7cef 100644 --- a/src/graphics/engine/particle.h +++ b/src/graphics/engine/particle.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/particle.h diff --git a/src/graphics/engine/planet.cpp b/src/graphics/engine/planet.cpp index 0c96f63..df34fbc 100644 --- a/src/graphics/engine/planet.cpp +++ b/src/graphics/engine/planet.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/planet.h" @@ -86,7 +88,7 @@ void CPlanet::LoadTexture() { for (int i = 0; i < static_cast<int>( m_planet[j].size() ); i++) { - m_engine->LoadTexture(m_planet[j][i].name); + m_engine->LoadTexture("textures/"+m_planet[j][i].name); } } } @@ -102,7 +104,7 @@ void CPlanet::Draw() for (int i = 0; i < static_cast<int>( m_planet[m_mode].size() ); i++) { - m_engine->SetTexture(m_planet[m_mode][i].name); + m_engine->SetTexture("textures/"+m_planet[m_mode][i].name); if (m_planet[m_mode][i].transparent) m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_ALPHA); diff --git a/src/graphics/engine/planet.h b/src/graphics/engine/planet.h index 58d3aeb..52ffd24 100644 --- a/src/graphics/engine/planet.h +++ b/src/graphics/engine/planet.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/planet.h diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp index d7edf51..8d5d323 100644 --- a/src/graphics/engine/pyro.cpp +++ b/src/graphics/engine/pyro.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/pyro.h" @@ -1594,7 +1596,7 @@ void CPyro::ExploStart() if (channel != -1) m_object->SetMasterParticle(i, channel); } - m_engine->LoadTexture("dirty04.png"); + m_engine->LoadTexture("textures/dirty04.png"); DeleteObject(false, true); // destroys the object transported + the battery } @@ -1637,7 +1639,7 @@ void CPyro::BurnStart() m_engine->ChangeSecondTexture(objRank, "dirty04.png"); } } - m_engine->LoadTexture("dirty04.png"); + m_engine->LoadTexture("textures/dirty04.png"); m_burnPartTotal = 0; diff --git a/src/graphics/engine/pyro.h b/src/graphics/engine/pyro.h index 60724b4..9646988 100644 --- a/src/graphics/engine/pyro.h +++ b/src/graphics/engine/pyro.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/pyro.h diff --git a/src/graphics/engine/terrain.cpp b/src/graphics/engine/terrain.cpp index 5f37cd8..21d7446 100644 --- a/src/graphics/engine/terrain.cpp +++ b/src/graphics/engine/terrain.cpp @@ -1,25 +1,26 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/terrain.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/logger.h" @@ -190,10 +191,10 @@ void CTerrain::AddMaterial(int id, const std::string& texName, const Math::Point bool CTerrain::LoadResources(const std::string& fileName) { CImage img; - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName); - if (! img.Load(path)) + + if (! img.Load(fileName)) { - GetLogger()->Error("Cannot load resource file: '%s'\n", path.c_str()); + GetLogger()->Error("Cannot load resource file: '%s'\n", fileName.c_str()); return false; } @@ -287,10 +288,10 @@ bool CTerrain::LoadRelief(const std::string &fileName, float scaleRelief, m_scaleRelief = scaleRelief; CImage img; - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_TEXTURE, fileName); - if (! img.Load(path)) + + if (! img.Load(fileName)) { - GetLogger()->Error("Could not load relief file: '%s'!\n", path.c_str()); + GetLogger()->Error("Could not load relief file: '%s'!\n", fileName.c_str()); return false; } @@ -366,17 +367,11 @@ bool CTerrain::RandomizeRelief() double xi, yi, a, b; a = modf(x * (rozmiar_oktawy-1), &xi); b = modf(y * (rozmiar_oktawy-1), &yi); - /*int xi = floor(x * (rozmiar_oktawy-1)); - int yi = floor(y * (rozmiar_oktawy-1)); - float a = (x * (rozmiar_oktawy-1)) - xi; - float b = (y * (rozmiar_oktawy-1)) - yi;*/ - //CLogger::GetInstancePointer()->Error("%f %f %f %f\n", xi, yi, a, b); float lg = oktawy[i][static_cast<int>(yi * rozmiar_oktawy + xi)]; float pg = oktawy[i][static_cast<int>(yi * rozmiar_oktawy + xi + 1)]; float ld = oktawy[i][static_cast<int>((yi+1) * rozmiar_oktawy + xi)]; float pd = oktawy[i][static_cast<int>((yi+1) * rozmiar_oktawy + xi + 1)]; - //CLogger::GetInstancePointer()->Error("%f %f %f %f\n", lg, pg, ld, pd); float g = pg * a + lg * (1-a); float d = pd * a + ld * (1-a); diff --git a/src/graphics/engine/terrain.h b/src/graphics/engine/terrain.h index 75a8975..a2bb36a 100644 --- a/src/graphics/engine/terrain.h +++ b/src/graphics/engine/terrain.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/terrain.h diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index 8fd01b7..bebf30c 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -1,29 +1,31 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/text.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/image.h" #include "common/logger.h" #include "common/stringutils.h" +#include "common/resources/resourcemanager.h" #include "math/func.h" @@ -78,12 +80,12 @@ bool CText::Create() return false; } - m_fonts[FONT_COLOBOT] = new MultisizeFont("dvu_sans.ttf"); - m_fonts[FONT_COLOBOT_BOLD] = new MultisizeFont("dvu_sans_bold.ttf"); - m_fonts[FONT_COLOBOT_ITALIC] = new MultisizeFont("dvu_sans_italic.ttf"); + m_fonts[FONT_COLOBOT] = new MultisizeFont("fonts/dvu_sans.ttf"); + m_fonts[FONT_COLOBOT_BOLD] = new MultisizeFont("fonts/dvu_sans_bold.ttf"); + m_fonts[FONT_COLOBOT_ITALIC] = new MultisizeFont("fonts/dvu_sans_italic.ttf"); - m_fonts[FONT_COURIER] = new MultisizeFont("dvu_sans_mono.ttf"); - m_fonts[FONT_COURIER_BOLD] = new MultisizeFont("dvu_sans_mono_bold.ttf"); + m_fonts[FONT_COURIER] = new MultisizeFont("fonts/dvu_sans_mono.ttf"); + m_fonts[FONT_COURIER_BOLD] = new MultisizeFont("fonts/dvu_sans_mono_bold.ttf"); for (auto it = m_fonts.begin(); it != m_fonts.end(); ++it) { @@ -866,10 +868,14 @@ CachedFont* CText::GetOrOpenFont(FontType font, float size) return m_lastCachedFont; } - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_FONT, mf->fileName); - m_lastCachedFont = new CachedFont(); - m_lastCachedFont->font = TTF_OpenFont(path.c_str(), pointSize); + SDL_RWops* file = CResourceManager::GetSDLFileHandler(mf->fileName); + if(file == nullptr) + { + m_error = std::string("Unable to open file"); + return nullptr; + } + m_lastCachedFont->font = TTF_OpenFontRW(file, 1, pointSize); if (m_lastCachedFont->font == nullptr) m_error = std::string("TTF_OpenFont error ") + std::string(TTF_GetError()); diff --git a/src/graphics/engine/text.h b/src/graphics/engine/text.h index 3abb8b7..0551dcd 100644 --- a/src/graphics/engine/text.h +++ b/src/graphics/engine/text.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/text.h diff --git a/src/graphics/engine/water.cpp b/src/graphics/engine/water.cpp index d1f8d29..8a396a8 100644 --- a/src/graphics/engine/water.cpp +++ b/src/graphics/engine/water.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/engine/water.h" @@ -348,8 +350,8 @@ void CWater::DrawSurf() material.ambient = m_ambient; m_engine->SetMaterial(material); - m_engine->SetTexture(m_fileName, 0); - m_engine->SetTexture(m_fileName, 1); + m_engine->SetTexture("textures/"+m_fileName, 0); + m_engine->SetTexture("textures/"+m_fileName, 1); if (m_type[rankview] == WATER_TT) m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_DUAL_WHITE | ENG_RSTATE_WRAP, m_color); @@ -492,7 +494,7 @@ void CWater::Create(WaterType type1, WaterType type2, const std::string& fileNam VaporFlush(); if (! m_fileName.empty()) - m_engine->LoadTexture(m_fileName); + m_engine->LoadTexture("textures/"+m_fileName); if (m_terrain == nullptr) m_terrain = CRobotMain::GetInstancePointer()->GetTerrain(); diff --git a/src/graphics/engine/water.h b/src/graphics/engine/water.h index 5e9f4b2..5e488d5 100644 --- a/src/graphics/engine/water.h +++ b/src/graphics/engine/water.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/engine/water.h diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index b42f29d..0ae6f88 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "graphics/opengl/gldevice.h" @@ -214,12 +217,25 @@ bool CGLDevice::Create() else { GetLogger()->Info("Auto-detecting VBO support\n"); - m_vboAvailable = glewIsSupported("GL_ARB_vertex_buffer_object"); + + // extracting OpenGL version + const char *version = reinterpret_cast<const char*>(glGetString(GL_VERSION)); + int major = 0, minor = 0; - if (m_vboAvailable) - GetLogger()->Info("Detected ARB_vertex_buffer_object extension - using VBOs\n"); + sscanf(version, "%d.%d", &major, &minor); + + // VBO is core OpenGL feature since 1.5 + // everything below 1.5 means no VBO support + if(major > 1 || minor > 4) + { + GetLogger()->Info("OpenGL %d.%d, VBO supported\n", major, minor); + m_vboAvailable = true; + } else - GetLogger()->Info("No ARB_vertex_buffer_object extension present - using display lists\n"); + { + GetLogger()->Info("OpenGL %d.%d, VBO not supported\n", major, minor); + m_vboAvailable = false; + } } } @@ -290,11 +306,6 @@ void CGLDevice::SetUseVbo(bool vboAvailable) m_vboAvailable = vboAvailable; } -bool CGLDevice::GetUseVbo() -{ - return m_vboAvailable; -} - void CGLDevice::BeginScene() { Clear(); @@ -339,44 +350,6 @@ void CGLDevice::SetTransform(TransformType type, const Math::Matrix &matrix) } } -const Math::Matrix& CGLDevice::GetTransform(TransformType type) -{ - if (type == TRANSFORM_WORLD) - return m_worldMat; - else if (type == TRANSFORM_VIEW) - return m_viewMat; - else if (type == TRANSFORM_PROJECTION) - return m_projectionMat; - else - assert(false); - - return m_worldMat; // to avoid warning -} - -void CGLDevice::MultiplyTransform(TransformType type, const Math::Matrix &matrix) -{ - if (type == TRANSFORM_WORLD) - { - m_worldMat = Math::MultiplyMatrices(m_worldMat, matrix); - UpdateModelviewMatrix(); - } - else if (type == TRANSFORM_VIEW) - { - m_viewMat = Math::MultiplyMatrices(m_viewMat, matrix); - UpdateModelviewMatrix(); - } - else if (type == TRANSFORM_PROJECTION) - { - m_projectionMat = Math::MultiplyMatrices(m_projectionMat, matrix); - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(m_projectionMat.Array()); - } - else - { - assert(false); - } -} - void CGLDevice::UpdateModelviewMatrix() { m_modelviewMat = Math::MultiplyMatrices(m_viewMat, m_worldMat); @@ -402,11 +375,6 @@ void CGLDevice::SetMaterial(const Material &material) glMaterialfv(GL_FRONT, GL_SPECULAR, m_material.specular.Array()); } -const Material& CGLDevice::GetMaterial() -{ - return m_material; -} - int CGLDevice::GetMaxLightCount() { return m_lights.size(); @@ -482,14 +450,6 @@ void CGLDevice::UpdateLightPosition(int index) glPopMatrix(); } -const Light& CGLDevice::GetLight(int index) -{ - assert(index >= 0); - assert(index < static_cast<int>( m_lights.size() )); - - return m_lights[index]; -} - void CGLDevice::SetLightEnabled(int index, bool enabled) { assert(index >= 0); @@ -503,14 +463,6 @@ void CGLDevice::SetLightEnabled(int index, bool enabled) glDisable(GL_LIGHT0 + index); } -bool CGLDevice::GetLightEnabled(int index) -{ - assert(index >= 0); - assert(index < static_cast<int>( m_lights.size() )); - - return m_lightsEnabled[index]; -} - /** If image is invalid, returns invalid texture. Otherwise, returns pointer to new Texture struct. This struct must not be deleted in other way than through DeleteTexture() */ @@ -781,15 +733,6 @@ void CGLDevice::SetTexture(int index, unsigned int textureId) UpdateTextureParams(index); } -/** - Returns the previously assigned texture or invalid texture if the given stage is not enabled. */ -Texture CGLDevice::GetTexture(int index) -{ - assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() )); - - return m_currentTextures[index]; -} - void CGLDevice::SetTextureEnabled(int index, bool enabled) { assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() )); @@ -813,13 +756,6 @@ void CGLDevice::SetTextureEnabled(int index, bool enabled) glDisable(GL_TEXTURE_2D); } -bool CGLDevice::GetTextureEnabled(int index) -{ - assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() )); - - return m_texturesEnabled[index]; -} - /** Sets the texture parameters for the given texture stage. If the given texture was not set (bound) yet, nothing happens. @@ -1002,13 +938,6 @@ void CGLDevice::SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wr else assert(false); } -TextureStageParams CGLDevice::GetTextureStageParams(int index) -{ - assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() )); - - return m_textureStageParams[index]; -} - GLenum TranslateGfxPrimitive(PrimitiveType type) { GLenum flag = 0; @@ -1529,30 +1458,6 @@ void CGLDevice::SetRenderState(RenderState state, bool enabled) glDisable(flag); } -bool CGLDevice::GetRenderState(RenderState state) -{ - if (state == RENDER_STATE_LIGHTING) - return m_lighting; - - GLenum flag = 0; - - switch (state) - { - case RENDER_STATE_DEPTH_WRITE: flag = GL_DEPTH_WRITEMASK; break; - case RENDER_STATE_BLENDING: flag = GL_BLEND; break; - case RENDER_STATE_FOG: flag = GL_FOG; break; - case RENDER_STATE_DEPTH_TEST: flag = GL_DEPTH_TEST; break; - case RENDER_STATE_ALPHA_TEST: flag = GL_ALPHA_TEST; break; - case RENDER_STATE_CULLING: flag = GL_CULL_FACE; break; - default: assert(false); break; - } - - GLboolean result = GL_FALSE; - glGetBooleanv(flag, &result); - - return result == GL_TRUE; -} - CompFunc TranslateGLCompFunc(GLenum flag) { switch (flag) @@ -1592,39 +1497,16 @@ void CGLDevice::SetDepthTestFunc(CompFunc func) glDepthFunc(TranslateGfxCompFunc(func)); } -CompFunc CGLDevice::GetDepthTestFunc() -{ - GLint flag = 0; - glGetIntegerv(GL_DEPTH_FUNC, &flag); - return TranslateGLCompFunc(static_cast<GLenum>(flag)); -} - void CGLDevice::SetDepthBias(float factor) { glPolygonOffset(factor, 0.0f); } -float CGLDevice::GetDepthBias() -{ - GLfloat result = 0.0f; - glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &result); - return result; -} - void CGLDevice::SetAlphaTestFunc(CompFunc func, float refValue) { glAlphaFunc(TranslateGfxCompFunc(func), refValue); } -void CGLDevice::GetAlphaTestFunc(CompFunc &func, float &refValue) -{ - GLint flag = 0; - glGetIntegerv(GL_ALPHA_TEST_FUNC, &flag); - func = TranslateGLCompFunc(static_cast<GLenum>(flag)); - - glGetFloatv(GL_ALPHA_TEST_REF, static_cast<GLfloat*>(&refValue)); -} - BlendFunc TranslateGLBlendFunc(GLenum flag) { switch (flag) @@ -1671,41 +1553,16 @@ void CGLDevice::SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) glBlendFunc(TranslateGfxBlendFunc(srcBlend), TranslateGfxBlendFunc(dstBlend)); } -void CGLDevice::GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend) -{ - GLint srcFlag = 0; - glGetIntegerv(GL_ALPHA_TEST_FUNC, &srcFlag); - srcBlend = TranslateGLBlendFunc(static_cast<GLenum>(srcFlag)); - - GLint dstFlag = 0; - glGetIntegerv(GL_ALPHA_TEST_FUNC, &dstFlag); - dstBlend = TranslateGLBlendFunc(static_cast<GLenum>(dstFlag)); -} - void CGLDevice::SetClearColor(const Color &color) { glClearColor(color.r, color.g, color.b, color.a); } -Color CGLDevice::GetClearColor() -{ - GLfloat color[4] = { 0.0f }; - glGetFloatv(GL_COLOR_CLEAR_VALUE, color); - return Color(color[0], color[1], color[2], color[3]); -} - void CGLDevice::SetGlobalAmbient(const Color &color) { glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.Array()); } -Color CGLDevice::GetGlobalAmbient() -{ - GLfloat color[4] = { 0.0f }; - glGetFloatv(GL_LIGHT_MODEL_AMBIENT, color); - return Color(color[0], color[1], color[2], color[3]); -} - void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, float end, float density) { if (mode == FOG_LINEAR) glFogi(GL_FOG_MODE, GL_LINEAR); @@ -1719,23 +1576,6 @@ void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, floa glFogfv(GL_FOG_COLOR, color.Array()); } -void CGLDevice::GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density) -{ - GLint flag = 0; - glGetIntegerv(GL_FOG_MODE, &flag); - if (flag == GL_LINEAR) mode = FOG_LINEAR; - else if (flag == GL_EXP) mode = FOG_EXP; - else if (flag == GL_EXP2) mode = FOG_EXP2; - else assert(false); - - glGetFloatv(GL_FOG_START, static_cast<GLfloat*>(&start)); - glGetFloatv(GL_FOG_END, static_cast<GLfloat*>(&end)); - glGetFloatv(GL_FOG_DENSITY, static_cast<GLfloat*>(&density)); - GLfloat col[4] = { 0.0f }; - glGetFloatv(GL_FOG_COLOR, col); - color = Color(col[0], col[1], col[2], col[3]); -} - void CGLDevice::SetCullMode(CullMode mode) { // Cull clockwise back faces, so front face is the opposite @@ -1745,16 +1585,6 @@ void CGLDevice::SetCullMode(CullMode mode) else assert(false); } -CullMode CGLDevice::GetCullMode() -{ - GLint flag = 0; - glGetIntegerv(GL_FRONT_FACE, &flag); - if (flag == GL_CW) return CULL_CCW; - else if (flag == GL_CCW) return CULL_CW; - else assert(false); - return CULL_CW; -} - void CGLDevice::SetShadeModel(ShadeModel model) { if (model == SHADE_FLAT) glShadeModel(GL_FLAT); @@ -1762,16 +1592,6 @@ void CGLDevice::SetShadeModel(ShadeModel model) else assert(false); } -ShadeModel CGLDevice::GetShadeModel() -{ - GLint flag = 0; - glGetIntegerv(GL_SHADE_MODEL, &flag); - if (flag == GL_FLAT) return SHADE_FLAT; - else if (flag == GL_SMOOTH) return SHADE_SMOOTH; - else assert(false); - return SHADE_FLAT; -} - void CGLDevice::SetFillMode(FillMode mode) { if (mode == FILL_POINT) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); @@ -1780,21 +1600,10 @@ void CGLDevice::SetFillMode(FillMode mode) else assert(false); } -FillMode CGLDevice::GetFillMode() -{ - GLint flag = 0; - glGetIntegerv(GL_POLYGON_MODE, &flag); - if (flag == GL_POINT) return FILL_POINT; - else if (flag == GL_LINE) return FILL_LINES; - else if (flag == GL_FILL) return FILL_POLY; - else assert(false); - return FILL_POINT; -} - void* CGLDevice::GetFrameBufferPixels()const{ - GLubyte* pixels = new GLubyte [4 * m_config.size.x * m_config.size.y]; - + GLubyte* pixels = new GLubyte[4 * m_config.size.x * m_config.size.y]; + glReadPixels(0, 0, m_config.size.x, m_config.size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels); unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) ); diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index 267ee73..723b0f2 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file graphics/opengl/gldevice.h @@ -92,103 +95,83 @@ public: CGLDevice(const GLDeviceConfig &config); virtual ~CGLDevice(); - virtual void DebugHook(); - virtual void DebugLights(); + virtual void DebugHook() override; + virtual void DebugLights() override; - virtual bool Create(); - virtual void Destroy(); + virtual bool Create() override; + virtual void Destroy() override; void ConfigChanged(const GLDeviceConfig &newConfig); void SetUseVbo(bool useVbo); - bool GetUseVbo(); - virtual void BeginScene(); - virtual void EndScene(); + virtual void BeginScene() override; + virtual void EndScene() override; - virtual void Clear(); + virtual void Clear() override; - virtual void SetTransform(TransformType type, const Math::Matrix &matrix); - virtual const Math::Matrix& GetTransform(TransformType type); - virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix); + virtual void SetTransform(TransformType type, const Math::Matrix &matrix) override; - virtual void SetMaterial(const Material &material); - virtual const Material& GetMaterial(); + virtual void SetMaterial(const Material &material) override; - virtual int GetMaxLightCount(); - virtual void SetLight(int index, const Light &light); - virtual const Light& GetLight(int index); - virtual void SetLightEnabled(int index, bool enabled); - virtual bool GetLightEnabled(int index); + virtual int GetMaxLightCount() override; + virtual void SetLight(int index, const Light &light) override; + virtual void SetLightEnabled(int index, bool enabled) override; - virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms); - virtual Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms); - virtual void DestroyTexture(const Texture &texture); - virtual void DestroyAllTextures(); + virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms) override; + virtual Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms) override; + virtual void DestroyTexture(const Texture &texture) override; + virtual void DestroyAllTextures() override; - virtual int GetMaxTextureStageCount(); - virtual void SetTexture(int index, const Texture &texture); - virtual void SetTexture(int index, unsigned int textureId); - virtual Texture GetTexture(int index); - virtual void SetTextureEnabled(int index, bool enabled); - virtual bool GetTextureEnabled(int index); + virtual int GetMaxTextureStageCount() override; + virtual void SetTexture(int index, const Texture &texture) override; + virtual void SetTexture(int index, unsigned int textureId) override; + virtual void SetTextureEnabled(int index, bool enabled) override; - virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms); - virtual TextureStageParams GetTextureStageParams(int index); + virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms) override; - virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT); + virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) override; virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices , int vertexCount, - Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)); + Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override; virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount, - Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)); - virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount); + Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override; + virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override; - virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount); - virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount); - virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount); - virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount); - virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount); - virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount); - virtual void DrawStaticBuffer(unsigned int bufferId); - virtual void DestroyStaticBuffer(unsigned int bufferId); + virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override; + virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override; + virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override; + virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override; + virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override; + virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override; + virtual void DrawStaticBuffer(unsigned int bufferId) override; + virtual void DestroyStaticBuffer(unsigned int bufferId) override; - virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius); + virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius) override; - virtual void SetRenderState(RenderState state, bool enabled); - virtual bool GetRenderState(RenderState state); + virtual void SetRenderState(RenderState state, bool enabled) override; - virtual void SetDepthTestFunc(CompFunc func); - virtual CompFunc GetDepthTestFunc(); + virtual void SetDepthTestFunc(CompFunc func) override; - virtual void SetDepthBias(float factor); - virtual float GetDepthBias(); + virtual void SetDepthBias(float factor) override; - virtual void SetAlphaTestFunc(CompFunc func, float refValue); - virtual void GetAlphaTestFunc(CompFunc &func, float &refValue); + virtual void SetAlphaTestFunc(CompFunc func, float refValue) override; - virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend); - virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend); + virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) override; - virtual void SetClearColor(const Color &color); - virtual Color GetClearColor(); + virtual void SetClearColor(const Color &color) override; - virtual void SetGlobalAmbient(const Color &color); - virtual Color GetGlobalAmbient(); + virtual void SetGlobalAmbient(const Color &color) override; - virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density); - virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density); + virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) override; - virtual void SetCullMode(CullMode mode); - virtual CullMode GetCullMode(); + virtual void SetCullMode(CullMode mode) override; - virtual void SetShadeModel(ShadeModel model); - virtual ShadeModel GetShadeModel(); + virtual void SetShadeModel(ShadeModel model) override; - virtual void SetFillMode(FillMode mode) ; - virtual FillMode GetFillMode(); + virtual void SetFillMode(FillMode mode) override; - virtual void* GetFrameBufferPixels()const; + virtual void* GetFrameBufferPixels() const override; private: //! Updates internal modelview matrix diff --git a/src/math/all.h b/src/math/all.h index 7d716c8..fc289ee 100644 --- a/src/math/all.h +++ b/src/math/all.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/all.h diff --git a/src/math/const.h b/src/math/const.h index fee635e..1e2cddf 100644 --- a/src/math/const.h +++ b/src/math/const.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/const.h diff --git a/src/math/func.h b/src/math/func.h index 98111c5..78bfeb4 100644 --- a/src/math/func.h +++ b/src/math/func.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/func.h diff --git a/src/math/geometry.h b/src/math/geometry.h index 9dcb447..595046e 100644 --- a/src/math/geometry.h +++ b/src/math/geometry.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/geometry.h diff --git a/src/math/intpoint.h b/src/math/intpoint.h index 872e614..7d27b33 100644 --- a/src/math/intpoint.h +++ b/src/math/intpoint.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/intpoint.h diff --git a/src/math/matrix.h b/src/math/matrix.h index f139517..75e515c 100644 --- a/src/math/matrix.h +++ b/src/math/matrix.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/matrix.h diff --git a/src/math/point.h b/src/math/point.h index edb902b..e8ae4d6 100644 --- a/src/math/point.h +++ b/src/math/point.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/point.h diff --git a/src/math/vector.h b/src/math/vector.h index 6827785..31a6162 100644 --- a/src/math/vector.h +++ b/src/math/vector.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file math/vector.h diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 9e593a9..fb6698b 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/auto.h" diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h index fd25e70..af7766c 100644 --- a/src/object/auto/auto.h +++ b/src/object/auto/auto.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // auto.h diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index af6c6e0..611730d 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include <stdio.h> @@ -1371,7 +1374,7 @@ void CAutoBase::BeginTransit() Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); - m_engine->LoadTexture(m_bgBack); + m_engine->LoadTexture("textures/"+m_bgBack); m_cloud->SetEnabled(false); // cache clouds m_planet->SetMode(1); @@ -1388,7 +1391,7 @@ void CAutoBase::EndTransit() m_engine->DeleteTexture(m_bgBack); m_engine->SetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown); - m_engine->LoadTexture(m_bgName); + m_engine->LoadTexture("textures/"+m_bgName); m_cloud->SetEnabled(true); // gives the clouds m_planet->SetMode(0); diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h index 967e43d..c0b2b88 100644 --- a/src/object/auto/autobase.h +++ b/src/object/auto/autobase.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autobase.h diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp index ee1e83b..5dc80e9 100644 --- a/src/object/auto/autoconvert.cpp +++ b/src/object/auto/autoconvert.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoconvert.h" diff --git a/src/object/auto/autoconvert.h b/src/object/auto/autoconvert.h index 56591f7..54cdb98 100644 --- a/src/object/auto/autoconvert.h +++ b/src/object/auto/autoconvert.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoconvert.h diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index 5b6cea4..f797ed9 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoderrick.h" diff --git a/src/object/auto/autoderrick.h b/src/object/auto/autoderrick.h index 81ed8b4..dd2f4d9 100644 --- a/src/object/auto/autoderrick.h +++ b/src/object/auto/autoderrick.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoderrick.h diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index dfe8e78..bc392f5 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autodestroyer.h" diff --git a/src/object/auto/autodestroyer.h b/src/object/auto/autodestroyer.h index ef3d5ae..14949e2 100644 --- a/src/object/auto/autodestroyer.h +++ b/src/object/auto/autodestroyer.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autodestroyer.h diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp index e510ca6..828821a 100644 --- a/src/object/auto/autoegg.cpp +++ b/src/object/auto/autoegg.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoegg.h" diff --git a/src/object/auto/autoegg.h b/src/object/auto/autoegg.h index 00725db..54c6e34 100644 --- a/src/object/auto/autoegg.h +++ b/src/object/auto/autoegg.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoegg.h diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index a38caf2..ea97cc8 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoenergy.h" diff --git a/src/object/auto/autoenergy.h b/src/object/auto/autoenergy.h index d3ed5fe..fc6f470 100644 --- a/src/object/auto/autoenergy.h +++ b/src/object/auto/autoenergy.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoenergy.h diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index 49abad4..825ea53 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autofactory.h" diff --git a/src/object/auto/autofactory.h b/src/object/auto/autofactory.h index d9350e6..60a44fb 100644 --- a/src/object/auto/autofactory.h +++ b/src/object/auto/autofactory.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autofactory.h diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp index cc00db0..402c87a 100644 --- a/src/object/auto/autoflag.cpp +++ b/src/object/auto/autoflag.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoflag.h" diff --git a/src/object/auto/autoflag.h b/src/object/auto/autoflag.h index c3fd35a..59c7b71 100644 --- a/src/object/auto/autoflag.h +++ b/src/object/auto/autoflag.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoflag.h diff --git a/src/object/auto/autohuston.cpp b/src/object/auto/autohuston.cpp index 80f9185..864919e 100644 --- a/src/object/auto/autohuston.cpp +++ b/src/object/auto/autohuston.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autohuston.h" diff --git a/src/object/auto/autohuston.h b/src/object/auto/autohuston.h index f99876a..d3f561c 100644 --- a/src/object/auto/autohuston.h +++ b/src/object/auto/autohuston.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autohuston.h diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp index 6d4a484..7b8622f 100644 --- a/src/object/auto/autoinfo.cpp +++ b/src/object/auto/autoinfo.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoinfo.h" diff --git a/src/object/auto/autoinfo.h b/src/object/auto/autoinfo.h index 41b74d3..632edf8 100644 --- a/src/object/auto/autoinfo.h +++ b/src/object/auto/autoinfo.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoinfo.h diff --git a/src/object/auto/autojostle.cpp b/src/object/auto/autojostle.cpp index 5ce01c2..4ff49e5 100644 --- a/src/object/auto/autojostle.cpp +++ b/src/object/auto/autojostle.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autojostle.h" diff --git a/src/object/auto/autojostle.h b/src/object/auto/autojostle.h index 3822421..faaea23 100644 --- a/src/object/auto/autojostle.h +++ b/src/object/auto/autojostle.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autojostle.h diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp index 7d61d64..b291280 100644 --- a/src/object/auto/autokid.cpp +++ b/src/object/auto/autokid.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autokid.h" diff --git a/src/object/auto/autokid.h b/src/object/auto/autokid.h index 19836a7..3fb5ca9 100644 --- a/src/object/auto/autokid.h +++ b/src/object/auto/autokid.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autokid.h diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index 07112b7..3a0be92 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autolabo.h" diff --git a/src/object/auto/autolabo.h b/src/object/auto/autolabo.h index b3b08bb..b62668e 100644 --- a/src/object/auto/autolabo.h +++ b/src/object/auto/autolabo.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autolabo.h diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp index 1e4796d..c05878d 100644 --- a/src/object/auto/automush.cpp +++ b/src/object/auto/automush.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/automush.h" diff --git a/src/object/auto/automush.h b/src/object/auto/automush.h index 1697c5a..2d70eaa 100644 --- a/src/object/auto/automush.h +++ b/src/object/auto/automush.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // automush.h diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp index 8a2d644..1c3b834 100644 --- a/src/object/auto/autonest.cpp +++ b/src/object/auto/autonest.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autonest.h" diff --git a/src/object/auto/autonest.h b/src/object/auto/autonest.h index 4d734a8..df16367 100644 --- a/src/object/auto/autonest.h +++ b/src/object/auto/autonest.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autonest.h diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index edab5eb..8fc7461 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autonuclear.h" diff --git a/src/object/auto/autonuclear.h b/src/object/auto/autonuclear.h index 5b01bba..83d8a91 100644 --- a/src/object/auto/autonuclear.h +++ b/src/object/auto/autonuclear.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autonuclear.h diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp index 24bc119..4a8e608 100644 --- a/src/object/auto/autopara.cpp +++ b/src/object/auto/autopara.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autopara.h" diff --git a/src/object/auto/autopara.h b/src/object/auto/autopara.h index 1f0b805..059d813 100644 --- a/src/object/auto/autopara.h +++ b/src/object/auto/autopara.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autopara.h diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp index 1646874..c0c4988 100644 --- a/src/object/auto/autoportico.cpp +++ b/src/object/auto/autoportico.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoportico.h" diff --git a/src/object/auto/autoportico.h b/src/object/auto/autoportico.h index 0aa580f..f055448 100644 --- a/src/object/auto/autoportico.h +++ b/src/object/auto/autoportico.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoportico.h diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp index 4afd3fe..1a1b209 100644 --- a/src/object/auto/autoradar.cpp +++ b/src/object/auto/autoradar.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoradar.h" diff --git a/src/object/auto/autoradar.h b/src/object/auto/autoradar.h index 86833f9..6cdb21a 100644 --- a/src/object/auto/autoradar.h +++ b/src/object/auto/autoradar.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoradar.h diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp index 2f813f8..f118ab5 100644 --- a/src/object/auto/autorepair.cpp +++ b/src/object/auto/autorepair.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autorepair.h" diff --git a/src/object/auto/autorepair.h b/src/object/auto/autorepair.h index f522a55..e377279 100644 --- a/src/object/auto/autorepair.h +++ b/src/object/auto/autorepair.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autorepair.h diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp index 834a48c..ed6ce9d 100644 --- a/src/object/auto/autoresearch.cpp +++ b/src/object/auto/autoresearch.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoresearch.h" diff --git a/src/object/auto/autoresearch.h b/src/object/auto/autoresearch.h index dcb9f7b..6b76b3d 100644 --- a/src/object/auto/autoresearch.h +++ b/src/object/auto/autoresearch.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoresearch.h diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp index 7e5c5e7..429f1c6 100644 --- a/src/object/auto/autoroot.cpp +++ b/src/object/auto/autoroot.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autoroot.h" diff --git a/src/object/auto/autoroot.h b/src/object/auto/autoroot.h index 3eb906c..88c85d5 100644 --- a/src/object/auto/autoroot.h +++ b/src/object/auto/autoroot.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autoroot.h diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp index 2871a70..7337c1b 100644 --- a/src/object/auto/autosafe.cpp +++ b/src/object/auto/autosafe.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autosafe.h" diff --git a/src/object/auto/autosafe.h b/src/object/auto/autosafe.h index b575b4e..60219dd 100644 --- a/src/object/auto/autosafe.h +++ b/src/object/auto/autosafe.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autosafe.h diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp index 2c0aa02..d5aa347 100644 --- a/src/object/auto/autostation.cpp +++ b/src/object/auto/autostation.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autostation.h" diff --git a/src/object/auto/autostation.h b/src/object/auto/autostation.h index d8a37b4..0c17948 100644 --- a/src/object/auto/autostation.h +++ b/src/object/auto/autostation.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autostation.h diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 329cab0..c06fa55 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/auto/autotower.h" diff --git a/src/object/auto/autotower.h b/src/object/auto/autotower.h index d219fb5..0158b22 100644 --- a/src/object/auto/autotower.h +++ b/src/object/auto/autotower.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // autotower.h diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 4bd8742..dec8cca 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/brain.h" @@ -812,11 +815,23 @@ void CBrain::StopProgram() void CBrain::StopTask() { - if ( m_primaryTask != 0 ) + if (m_primaryTask != nullptr) { m_primaryTask->Abort(); delete m_primaryTask; // stops the current task - m_primaryTask = 0; + m_primaryTask = nullptr; + } +} + +// Stops the current secondary task. + +void CBrain::StopSecondaryTask() +{ + if (m_secondaryTask != nullptr) + { + m_secondaryTask->Abort(); + delete m_secondaryTask; // stops the current secondary task + m_secondaryTask = nullptr; } } @@ -900,16 +915,10 @@ void CBrain::StopEditScript(bool bCancel) Error CBrain::StartTaskTake() { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskTake(); + Error err = m_primaryTask->StartTaskTake(); UpdateInterface(); return err; } @@ -918,16 +927,10 @@ Error CBrain::StartTaskTake() Error CBrain::StartTaskManip(TaskManipOrder order, TaskManipArm arm) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskManip(order, arm); + Error err = m_primaryTask->StartTaskManip(order, arm); UpdateInterface(); return err; } @@ -936,16 +939,10 @@ Error CBrain::StartTaskManip(TaskManipOrder order, TaskManipArm arm) Error CBrain::StartTaskFlag(TaskFlagOrder order, int rank) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskFlag(order, rank); + Error err = m_primaryTask->StartTaskFlag(order, rank); UpdateInterface(); return err; } @@ -954,16 +951,10 @@ Error CBrain::StartTaskFlag(TaskFlagOrder order, int rank) Error CBrain::StartTaskBuild(ObjectType type) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskBuild(type); + Error err = m_primaryTask->StartTaskBuild(type); UpdateInterface(); return err; } @@ -972,16 +963,10 @@ Error CBrain::StartTaskBuild(ObjectType type) Error CBrain::StartTaskSearch() { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskSearch(); + Error err = m_primaryTask->StartTaskSearch(); UpdateInterface(); return err; } @@ -990,38 +975,26 @@ Error CBrain::StartTaskSearch() Error CBrain::StartTaskTerraform() { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskTerraform(); + Error err = m_primaryTask->StartTaskTerraform(); UpdateInterface(); return err; } // Change pencil. -Error CBrain::StartTaskPen(bool bDown, int color) +Error CBrain::StartTaskPen(bool down, int color) { - Error err; - m_physics->SetMotorSpeedX(0.0f); m_physics->SetMotorSpeedY(0.0f); m_physics->SetMotorSpeedZ(0.0f); - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskPen(bDown, color); + Error err = m_primaryTask->StartTaskPen(down, color); UpdateInterface(); return err; } @@ -1030,16 +1003,10 @@ Error CBrain::StartTaskPen(bool bDown, int color) Error CBrain::StartTaskRecover() { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskRecover(); + Error err = m_primaryTask->StartTaskRecover(); UpdateInterface(); return err; } @@ -1048,16 +1015,10 @@ Error CBrain::StartTaskRecover() Error CBrain::StartTaskShield(TaskShieldMode mode) { - Error err; - - if ( m_secondaryTask != 0 ) - { - delete m_secondaryTask; // stops the current task - m_secondaryTask = 0; - } + StopSecondaryTask(); m_secondaryTask = new CTaskManager(m_object); - err = m_secondaryTask->StartTaskShield(mode, 1000.0f); + Error err = m_secondaryTask->StartTaskShield(mode, 1000.0f); UpdateInterface(); return err; } @@ -1066,16 +1027,10 @@ Error CBrain::StartTaskShield(TaskShieldMode mode) Error CBrain::StartTaskFire(float delay) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskFire(delay); + Error err = m_primaryTask->StartTaskFire(delay); UpdateInterface(); return err; } @@ -1084,16 +1039,10 @@ Error CBrain::StartTaskFire(float delay) Error CBrain::StartTaskSpiderExplo() { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskSpiderExplo(); + Error err = m_primaryTask->StartTaskSpiderExplo(); UpdateInterface(); return err; } @@ -1102,16 +1051,10 @@ Error CBrain::StartTaskSpiderExplo() Error CBrain::StartTaskFireAnt(Math::Vector impact) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskFireAnt(impact); + Error err = m_primaryTask->StartTaskFireAnt(impact); UpdateInterface(); return err; } @@ -1120,16 +1063,10 @@ Error CBrain::StartTaskFireAnt(Math::Vector impact) Error CBrain::StartTaskGunGoal(float dirV, float dirH) { - Error err; - - if ( m_secondaryTask != 0 ) - { - delete m_secondaryTask; // stops the current task - m_secondaryTask = 0; - } + StopSecondaryTask(); m_secondaryTask = new CTaskManager(m_object); - err = m_secondaryTask->StartTaskGunGoal(dirV, dirH); + Error err = m_secondaryTask->StartTaskGunGoal(dirV, dirH); UpdateInterface(); return err; } @@ -1138,16 +1075,10 @@ Error CBrain::StartTaskGunGoal(float dirV, float dirH) Error CBrain::StartTaskReset(Math::Vector goal, Math::Vector angle) { - Error err; - - if ( m_primaryTask != 0 ) - { - delete m_primaryTask; // stops the current task - m_primaryTask = 0; - } + StopTask(); m_primaryTask = new CTaskManager(m_object); - err = m_primaryTask->StartTaskReset(goal, angle); + Error err = m_primaryTask->StartTaskReset(goal, angle); UpdateInterface(); return err; } @@ -1156,30 +1087,29 @@ Error CBrain::StartTaskReset(Math::Vector goal, Math::Vector angle) Error CBrain::EndedTask() { - Error err; - - if ( m_secondaryTask != 0 ) // current task? + if (m_secondaryTask != nullptr) // current task? { - err = m_secondaryTask->IsEnded(); + Error err = m_secondaryTask->IsEnded(); if ( err != ERR_CONTINUE ) // job ended? { delete m_secondaryTask; - m_secondaryTask = 0; + m_secondaryTask = nullptr; UpdateInterface(); } } - if ( m_primaryTask != 0 ) // current task? + if (m_primaryTask != nullptr) // current task? { - err = m_primaryTask->IsEnded(); + Error err = m_primaryTask->IsEnded(); if ( err != ERR_CONTINUE ) // job ended? { delete m_primaryTask; - m_primaryTask = 0; + m_primaryTask = nullptr; UpdateInterface(); } return err; } + return ERR_STOP; } diff --git a/src/object/brain.h b/src/object/brain.h index a1f5da7..a0d1869 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file object/brain.h @@ -102,6 +105,7 @@ public: int GetProgram(); void StopProgram(); void StopTask(); + void StopSecondaryTask(); bool IntroduceVirus(); void SetActiveVirus(bool bActive); @@ -128,7 +132,7 @@ public: Error StartTaskBuild(ObjectType type); Error StartTaskSearch(); Error StartTaskTerraform(); - Error StartTaskPen(bool bDown, int color); + Error StartTaskPen(bool down, int color); Error StartTaskRecover(); Error StartTaskShield(TaskShieldMode mode); Error StartTaskFire(float delay); diff --git a/src/object/level/parser.cpp b/src/object/level/parser.cpp new file mode 100644 index 0000000..ab3e6bc --- /dev/null +++ b/src/object/level/parser.cpp @@ -0,0 +1,244 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "object/level/parser.h" + + +#include "app/app.h" + +#include "common/resources/inputstream.h" + +#include "object/level/parserexceptions.h" + +#include "object/robotmain.h" + +#include <string> +#include <exception> +#include <sstream> +#include <iomanip> + +#include <boost/algorithm/string/trim.hpp> +#include <boost/algorithm/string/replace.hpp> +#include <boost/lexical_cast.hpp> + +CLevelParser::CLevelParser() +{ + m_filename = ""; +} + +CLevelParser::CLevelParser(std::string filename) +{ + m_filename = filename; +} + +CLevelParser::CLevelParser(std::string category, int chapter, int rank) +{ + m_filename = BuildSceneName(category, chapter, rank); +} + +CLevelParser::~CLevelParser() +{ + for(auto line : m_lines) + { + delete line; + } +} + +std::string CLevelParser::BuildSceneName(std::string category, int chapter, int rank, bool sceneFile) +{ + std::ostringstream outstream; + if(category == "custom") + { + outstream << "levels/custom/"; + outstream << CRobotMain::GetInstancePointer()->GetUserLevelName(chapter); + if(rank == 000) + { + if(sceneFile) + { + outstream << "/chaptertitle.txt"; + } + } + else + { + outstream << "/level" << std::setfill('0') << std::setw(3) << rank; + if(sceneFile) + { + outstream << "/scene.txt"; + } + } + } + else if(category == "perso") + { + outstream << "levels/other/perso.txt"; + } + else if(category == "win" || category == "lost") + { + outstream << "levels/other/"; + outstream << category << std::setfill('0') << std::setw(3) << chapter*100+rank << ".txt"; + } + else + { + outstream << "levels/" << category << "/"; + outstream << "chapter" << std::setfill('0') << std::setw(3) << chapter; + if(rank == 000) + { + if(sceneFile) + { + outstream << "/chaptertitle.txt"; + } + } + else + { + outstream << "/level" << std::setfill('0') << std::setw(3) << rank; + if(sceneFile) + { + outstream << "/scene.txt"; + } + } + } + return outstream.str(); +} + +void CLevelParser::Load() +{ + CInputStream file; + file.open(m_filename); + if(!file.is_open()) + throw CLevelParserException("Failed to open file: "+m_filename); + + char lang = CApplication::GetInstancePointer()->GetLanguageChar(); + + std::string line; + int lineNumber = 0; + std::map<std::string, CLevelParserLine*> translatableLines; + while(getline(file,line)) + { + lineNumber++; + + boost::replace_all(line, "\t", " "); // replace tab by space + + // ignore comments + std::size_t comment = line.find("//"); + if(comment != std::string::npos) + line = line.substr(0, comment); + + boost::algorithm::trim(line); + + std::size_t pos = line.find_first_of(" \t\n"); + std::string command = line.substr(0, pos); + if(pos != std::string::npos) { + line = line.substr(pos+1); + boost::algorithm::trim(line); + } else { + line = ""; + } + if(command.empty()) continue; + + CLevelParserLine* parserLine = new CLevelParserLine(lineNumber, command); + + std::string baseCommand = command; + if(command[command.length()-2] == '.') { + baseCommand = command.substr(0, command.length()-2); + if(command[command.length()-1] == 'E' && translatableLines[baseCommand] == nullptr) { + parserLine->SetCommand(baseCommand); + translatableLines[baseCommand] = parserLine; + } else if(command[command.length()-1] == lang) { + if(translatableLines[baseCommand] != nullptr) { + m_lines.erase(std::remove(m_lines.begin(), m_lines.end(), translatableLines[baseCommand]), m_lines.end()); + delete translatableLines[baseCommand]; + } + parserLine->SetCommand(baseCommand); + translatableLines[baseCommand] = parserLine; + } else { + delete parserLine; + continue; + } + } + + while(!line.empty()) { + pos = line.find_first_of("="); + std::string paramName = line.substr(0, pos); + boost::algorithm::trim(paramName); + line = line.substr(pos+1); + boost::algorithm::trim(line); + + if(line[0] == '\"') { + pos = line.find_first_of("\"", 1); + if(pos == std::string::npos) + throw CLevelParserException("Unclosed \" in "+m_filename+":"+boost::lexical_cast<std::string>(lineNumber)); + } else if(line[0] == '\'') { + pos = line.find_first_of("'", 1); + if(pos == std::string::npos) + throw CLevelParserException("Unclosed ' in "+m_filename+":"+boost::lexical_cast<std::string>(lineNumber)); + } else { + pos = line.find_first_of("="); + if(pos != std::string::npos) { + std::size_t pos2 = line.find_last_of(" \t\n", line.find_last_not_of(" \t\n", pos-1)); + if(pos2 != std::string::npos) + pos = pos2; + } else { + pos = line.length()-1; + } + } + std::string paramValue = line.substr(0, pos+1); + boost::algorithm::trim(paramValue); + + parserLine->AddParam(paramName, new CLevelParserParam(paramName, paramValue)); + + if(pos == std::string::npos) + break; + line = line.substr(pos+1); + boost::algorithm::trim(line); + } + + AddLine(parserLine); + } + + file.close(); +} + +void CLevelParser::Save(std::string filename) +{ + assert(false); //TODO +} + +const std::string& CLevelParser::GetFilename() +{ + return m_filename; +} + +std::vector<CLevelParserLine*> CLevelParser::GetLines() +{ + return m_lines; +} + +void CLevelParser::AddLine(CLevelParserLine* line) +{ + line->SetLevel(this); + m_lines.push_back(line); +} + +CLevelParserLine* CLevelParser::Get(std::string command) +{ + for(auto& line : m_lines) { + if(line->GetCommand() == command) + return line; + } + throw CLevelParserException("Command not found: "+command); +} diff --git a/src/object/level/parser.h b/src/object/level/parser.h new file mode 100644 index 0000000..7e87e2d --- /dev/null +++ b/src/object/level/parser.h @@ -0,0 +1,69 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +/** + * \file object/level/parser.h + * \brief Parser for level files + */ + +#pragma once + +#include "object/level/parserline.h" +#include "object/level/parserparam.h" +#include "object/level/parserexceptions.h" + +#include <string> +#include <vector> + +class CLevelParser +{ +public: + //! Create an empty level file + CLevelParser(); + //! Load level from file + CLevelParser(std::string filename); + //! Load given level + CLevelParser(std::string category, int chapter, int rank); + + ~CLevelParser(); + + //! Build level filename + static std::string BuildSceneName(std::string category, int chapter, int rank, bool sceneFile = true); + + //! Load file + void Load(); + //! Save file + void Save(std::string filename); + + //! Get filename + const std::string& GetFilename(); + + //! Get all lines from file + std::vector<CLevelParserLine*> GetLines(); + //! Insert new line to file + void AddLine(CLevelParserLine* line); + + //! Find first line with given command + CLevelParserLine* Get(std::string command); + +private: + + std::string m_filename; + std::vector<CLevelParserLine*> m_lines; +};
\ No newline at end of file diff --git a/src/object/level/parserexceptions.cpp b/src/object/level/parserexceptions.cpp new file mode 100644 index 0000000..8f74078 --- /dev/null +++ b/src/object/level/parserexceptions.cpp @@ -0,0 +1,45 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "object/level/parserexceptions.h" + + +#include "object/level/parser.h" + +#include <boost/lexical_cast.hpp> + +CLevelParserException::CLevelParserException(std::string message) noexcept +{ + m_message = message; +} + +const char* CLevelParserException::what() const noexcept +{ + return m_message.c_str(); +} + +CLevelParserExceptionMissingParam::CLevelParserExceptionMissingParam(CLevelParserParam* thisParam) noexcept +: CLevelParserException("Missing required param "+thisParam->GetName()+" (in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+boost::lexical_cast<std::string>(thisParam->GetLine()->GetLineNumber())+")") +{ +} + +CLevelParserExceptionBadParam::CLevelParserExceptionBadParam(CLevelParserParam* thisParam, std::string requestedType) noexcept +: CLevelParserException("Unable to parse '"+thisParam->GetValue()+"' as "+requestedType+" (param '"+thisParam->GetName()+"' in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+boost::lexical_cast<std::string>(thisParam->GetLine()->GetLineNumber())+")") +{ +} diff --git a/src/object/level/parserexceptions.h b/src/object/level/parserexceptions.h new file mode 100644 index 0000000..7265d8b --- /dev/null +++ b/src/object/level/parserexceptions.h @@ -0,0 +1,55 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +/** + * \file object/level/parserexceptions.h + * \brief Exceptions that could be thrown in level parser + */ + +#pragma once + +#include <exception> +#include <string> + +class CLevelParserParam; + +class CLevelParserException : public std::exception +{ +public: + CLevelParserException(std::string message) noexcept; + virtual ~CLevelParserException() noexcept {} + const char* what() const noexcept; + +protected: + std::string m_message; +}; + +class CLevelParserExceptionMissingParam : public CLevelParserException +{ +public: + CLevelParserExceptionMissingParam(CLevelParserParam* thisParam) noexcept; + virtual ~CLevelParserExceptionMissingParam() noexcept {} +}; + +class CLevelParserExceptionBadParam : public CLevelParserException +{ +public: + CLevelParserExceptionBadParam(CLevelParserParam* thisParam, std::string requestedType) noexcept; + virtual ~CLevelParserExceptionBadParam() noexcept {} +};
\ No newline at end of file diff --git a/src/object/level/parserline.cpp b/src/object/level/parserline.cpp new file mode 100644 index 0000000..e0e8097 --- /dev/null +++ b/src/object/level/parserline.cpp @@ -0,0 +1,90 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "object/level/parserline.h" + + +#include "object/level/parser.h" +#include "common/logger.h" + +CLevelParserLine::CLevelParserLine(std::string command) +{ + m_command = command; + m_lineNumber = 0; +} + +CLevelParserLine::CLevelParserLine(int lineNumber, std::string command) +{ + m_command = command; + m_lineNumber = lineNumber; +} + +CLevelParserLine::~CLevelParserLine() +{ + for(auto param : m_params) + { + delete param.second; + } +} + +std::string CLevelParserLine::GetLine() +{ + assert(false); //TODO +} + +int CLevelParserLine::GetLineNumber() +{ + return m_lineNumber; +} + +CLevelParser* CLevelParserLine::GetLevel() +{ + return m_level; +} + +void CLevelParserLine::SetLevel(CLevelParser* level) +{ + m_level = level; +} + +std::string CLevelParserLine::GetCommand() +{ + return m_command; +} + +void CLevelParserLine::SetCommand(std::string command) +{ + m_command = command; +} + +CLevelParserParam* CLevelParserLine::GetParam(std::string name) +{ + if(m_params[name] == nullptr) { + CLevelParserParam* param = new CLevelParserParam(name, true); + param->SetLine(this); + m_params[name] = param; + } + return m_params[name]; +} + +void CLevelParserLine::AddParam(std::string name, CLevelParserParam* value) +{ + value->SetLine(this); + m_params[name] = value; +}
\ No newline at end of file diff --git a/src/object/level/parserline.h b/src/object/level/parserline.h new file mode 100644 index 0000000..9881ac7 --- /dev/null +++ b/src/object/level/parserline.h @@ -0,0 +1,62 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +/** + * \file object/level/parserline.h + * \brief Class for one line from level file + */ + +#pragma once + +#include <string> +#include <map> + +class CLevelParser; +class CLevelParserParam; + +class CLevelParserLine +{ +public: + CLevelParserLine(int lineNumber, std::string command); + CLevelParserLine(std::string command); + ~CLevelParserLine(); + + //! Get line to be saved in level file + std::string GetLine(); + + //! Get line number + int GetLineNumber(); + + //! Get CLevelParser this line is part of + CLevelParser* GetLevel(); + //! Set CLevelParser this line is part of + void SetLevel(CLevelParser* level); + + std::string GetCommand(); + void SetCommand(std::string command); + + CLevelParserParam* GetParam(std::string name); + void AddParam(std::string name, CLevelParserParam* value); + +private: + CLevelParser* m_level; + int m_lineNumber; + std::string m_command; + std::map<std::string, CLevelParserParam*> m_params; +};
\ No newline at end of file diff --git a/src/object/level/parserparam.cpp b/src/object/level/parserparam.cpp new file mode 100644 index 0000000..aa5a963 --- /dev/null +++ b/src/object/level/parserparam.cpp @@ -0,0 +1,940 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +#include "object/level/parserline.h" + + +#include "app/app.h" +#include "common/logger.h" +#include "object/level/parser.h" +#include "object/robotmain.h" + +#include <boost/lexical_cast.hpp> +#include <boost/algorithm/string.hpp> + +CLevelParserParam::CLevelParserParam(std::string name, std::string value) +{ + m_name = name; + m_value = value; + m_empty = false; +} + +CLevelParserParam::CLevelParserParam(std::string name, bool empty) +{ + assert(empty == true); // we need a second argument because we don't want to create param with value "name" + m_name = name; + m_value = ""; + m_empty = true; +} + +CLevelParserParam::~CLevelParserParam() +{ + for(auto& a : m_array) + delete a; +} + +void CLevelParserParam::SetLine(CLevelParserLine* line) +{ + m_line = line; +} + +CLevelParserLine* CLevelParserParam::GetLine() +{ + return m_line; +} + +std::string CLevelParserParam::GetName() +{ + return m_name; +} + +std::string CLevelParserParam::GetValue() +{ + return m_value; +} + +bool CLevelParserParam::IsDefined() +{ + return !m_empty; +} + +template<typename T> +T CLevelParserParam::Cast(std::string value, std::string requestedType) +{ + try { + return boost::lexical_cast<T>(value); + } + catch(...) + { + throw CLevelParserExceptionBadParam(this, requestedType); + } +} + +template<typename T> +T CLevelParserParam::Cast(std::string requestedType) +{ + return Cast<T>(m_value, requestedType); +} + + +int CLevelParserParam::AsInt() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return Cast<int>("int"); +} + + +int CLevelParserParam::AsInt(int def) +{ + if(m_empty) + return def; + return AsInt(); +} + + +float CLevelParserParam::AsFloat() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return Cast<float>("float"); +} + +float CLevelParserParam::AsFloat(float def) +{ + if(m_empty) + return def; + return AsFloat(); +} + + +std::string CLevelParserParam::AsString() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + if((m_value[0] == '\"' && m_value[m_value.length()-1] == '\"') || (m_value[0] == '\'' && m_value[m_value.length()-1] == '\'')) + { + return m_value.substr(1, m_value.length()-2); + } else { + throw CLevelParserExceptionBadParam(this, "string"); + } +} + +std::string CLevelParserParam::AsString(std::string def) +{ + if(m_empty) + return def; + return AsString(); +} + + +bool CLevelParserParam::AsBool() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + std::string value = m_value; + boost::to_lower(value); + if(value == "true") return true; + if(value == "false") return false; + return Cast<bool>("bool"); +} + +bool CLevelParserParam::AsBool(bool def) +{ + if(m_empty) + return def; + return AsBool(); +} + + +std::string CLevelParserParam::InjectLevelDir(std::string path, const std::string defaultDir) +{ + std::string newPath = path; + std::string lvlDir = CLevelParser::BuildSceneName(CRobotMain::GetInstancePointer()->GetSceneName(), CRobotMain::GetInstancePointer()->GetSceneRank()/100, CRobotMain::GetInstancePointer()->GetSceneRank()%100, false); + boost::replace_all(newPath, "%lvl%", lvlDir); + std::string chapDir = CLevelParser::BuildSceneName(CRobotMain::GetInstancePointer()->GetSceneName(), CRobotMain::GetInstancePointer()->GetSceneRank()/100, 0, false); + boost::replace_all(newPath, "%chap%", chapDir); + if(newPath == path) + { + newPath = defaultDir + (!defaultDir.empty() ? "/" : "") + newPath; + } + //TODO: Fallback to English + std::string langStr(1, CApplication::GetInstancePointer()->GetLanguageChar()); + boost::replace_all(newPath, "%lng%", langStr); + return newPath; +} + +std::string CLevelParserParam::ToPath(std::string path, const std::string defaultDir) +{ + if(defaultDir == "" && path.find("%lvl%") != std::string::npos) + throw CLevelParserException("TODO: Param "+m_name+" does not yet support %lvl%! :("); + + return InjectLevelDir(path, defaultDir); +} + +std::string CLevelParserParam::AsPath(const std::string defaultDir) +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + + return ToPath(AsString(), defaultDir); +} + +std::string CLevelParserParam::AsPath(const std::string defaultDir, std::string def) +{ + if(m_empty) + return InjectLevelDir(def, defaultDir); + + return ToPath(AsString(def), defaultDir); +} + + +Gfx::Color CLevelParserParam::AsColor() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + + ParseArray(); + + if(m_array.size() == 3) { //RGB + return Gfx::Color(m_array[0]->AsFloat(), m_array[1]->AsFloat(), m_array[2]->AsFloat()); + } else if(m_array.size() == 4) { //RGBA + return Gfx::Color(m_array[0]->AsFloat(), m_array[1]->AsFloat(), m_array[2]->AsFloat(), m_array[3]->AsFloat()); + } else { + throw CLevelParserExceptionBadParam(this, "color"); + } +} + +Gfx::Color CLevelParserParam::AsColor(Gfx::Color def) +{ + if(m_empty) + return def; + return AsColor(); +} + + +Math::Vector CLevelParserParam::AsPoint() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + + ParseArray(); + + if(m_array.size() == 2) { //XZ + return Math::Vector(m_array[0]->AsFloat(), 0.0f, m_array[1]->AsFloat()); + } else if(m_array.size() == 3) { //XYZ + return Math::Vector(m_array[0]->AsFloat(), m_array[1]->AsFloat(), m_array[2]->AsFloat()); + } else { + throw CLevelParserExceptionBadParam(this, "point"); + } +} + +Math::Vector CLevelParserParam::AsPoint(Math::Vector def) +{ + if(m_empty) + return def; + return AsPoint(); +} + + +ObjectType CLevelParserParam::ToObjectType(std::string value) +{ + if(value == "All" ) return OBJECT_NULL; + if(value == "Portico" ) return OBJECT_PORTICO; + if(value == "SpaceShip" ) return OBJECT_BASE; + if(value == "PracticeBot" ) return OBJECT_MOBILEwt; + if(value == "WingedGrabber" ) return OBJECT_MOBILEfa; + if(value == "TrackedGrabber" ) return OBJECT_MOBILEta; + if(value == "WheeledGrabber" ) return OBJECT_MOBILEwa; + if(value == "LeggedGrabber" ) return OBJECT_MOBILEia; + if(value == "WingedShooter" ) return OBJECT_MOBILEfc; + if(value == "TrackedShooter" ) return OBJECT_MOBILEtc; + if(value == "WheeledShooter" ) return OBJECT_MOBILEwc; + if(value == "LeggedShooter" ) return OBJECT_MOBILEic; + if(value == "WingedOrgaShooter" ) return OBJECT_MOBILEfi; + if(value == "TrackedOrgaShooter") return OBJECT_MOBILEti; + if(value == "WheeledOrgaShooter") return OBJECT_MOBILEwi; + if(value == "LeggedOrgaShooter" ) return OBJECT_MOBILEii; + if(value == "WingedSniffer" ) return OBJECT_MOBILEfs; + if(value == "TrackedSniffer" ) return OBJECT_MOBILEts; + if(value == "WheeledSniffer" ) return OBJECT_MOBILEws; + if(value == "LeggedSniffer" ) return OBJECT_MOBILEis; + if(value == "Thumper" ) return OBJECT_MOBILErt; + if(value == "PhazerShooter" ) return OBJECT_MOBILErc; + if(value == "Recycler" ) return OBJECT_MOBILErr; + if(value == "Shielder" ) return OBJECT_MOBILErs; + if(value == "Subber" ) return OBJECT_MOBILEsa; + if(value == "TargetBot" ) return OBJECT_MOBILEtg; + if(value == "Scribbler" ) return OBJECT_MOBILEdr; + if(value == "PowerSpot" ) return OBJECT_MARKPOWER; + if(value == "TitaniumSpot" ) return OBJECT_MARKSTONE; + if(value == "UraniumSpot" ) return OBJECT_MARKURANIUM; + if(value == "PlatinumSpot" ) return OBJECT_MARKURANIUM; + if(value == "KeyASpot" ) return OBJECT_MARKKEYa; + if(value == "KeyBSpot" ) return OBJECT_MARKKEYb; + if(value == "KeyCSpot" ) return OBJECT_MARKKEYc; + if(value == "KeyDSpot" ) return OBJECT_MARKKEYd; + if(value == "WayPoint" ) return OBJECT_WAYPOINT; + if(value == "BlueFlag" ) return OBJECT_FLAGb; + if(value == "RedFlag" ) return OBJECT_FLAGr; + if(value == "GreenFlag" ) return OBJECT_FLAGg; + if(value == "YellowFlag" ) return OBJECT_FLAGy; + if(value == "VioletFlag" ) return OBJECT_FLAGv; + if(value == "PowerCell" ) return OBJECT_POWER; + if(value == "FuelCellPlant" ) return OBJECT_NUCLEAR; + if(value == "FuelCell" ) return OBJECT_ATOMIC; + if(value == "NuclearCell" ) return OBJECT_ATOMIC; + if(value == "TitaniumOre" ) return OBJECT_STONE; + if(value == "UraniumOre" ) return OBJECT_URANIUM; + if(value == "PlatinumOre" ) return OBJECT_URANIUM; + if(value == "Titanium" ) return OBJECT_METAL; + if(value == "OrgaMatter" ) return OBJECT_BULLET; + if(value == "BlackBox" ) return OBJECT_BBOX; + if(value == "KeyA" ) return OBJECT_KEYa; + if(value == "KeyB" ) return OBJECT_KEYb; + if(value == "KeyC" ) return OBJECT_KEYc; + if(value == "KeyD" ) return OBJECT_KEYd; + if(value == "TNT" ) return OBJECT_TNT; + if(value == "Scrap1" ) return OBJECT_SCRAP1; + if(value == "Scrap2" ) return OBJECT_SCRAP2; + if(value == "Scrap3" ) return OBJECT_SCRAP3; + if(value == "Scrap4" ) return OBJECT_SCRAP4; + if(value == "Scrap5" ) return OBJECT_SCRAP5; + if(value == "Mine" ) return OBJECT_BOMB; + if(value == "Firework" ) return OBJECT_WINFIRE; + if(value == "Bag" ) return OBJECT_BAG; + if(value == "Greenery0" ) return OBJECT_PLANT0; + if(value == "Greenery1" ) return OBJECT_PLANT1; + if(value == "Greenery2" ) return OBJECT_PLANT2; + if(value == "Greenery3" ) return OBJECT_PLANT3; + if(value == "Greenery4" ) return OBJECT_PLANT4; + if(value == "Greenery5" ) return OBJECT_PLANT5; + if(value == "Greenery6" ) return OBJECT_PLANT6; + if(value == "Greenery7" ) return OBJECT_PLANT7; + if(value == "Greenery8" ) return OBJECT_PLANT8; + if(value == "Greenery9" ) return OBJECT_PLANT9; + if(value == "Greenery10" ) return OBJECT_PLANT10; + if(value == "Greenery11" ) return OBJECT_PLANT11; + if(value == "Greenery12" ) return OBJECT_PLANT12; + if(value == "Greenery13" ) return OBJECT_PLANT13; + if(value == "Greenery14" ) return OBJECT_PLANT14; + if(value == "Greenery15" ) return OBJECT_PLANT15; + if(value == "Greenery16" ) return OBJECT_PLANT16; + if(value == "Greenery17" ) return OBJECT_PLANT17; + if(value == "Greenery18" ) return OBJECT_PLANT18; + if(value == "Greenery19" ) return OBJECT_PLANT19; + if(value == "Tree0" ) return OBJECT_TREE0; + if(value == "Tree1" ) return OBJECT_TREE1; + if(value == "Tree2" ) return OBJECT_TREE2; + if(value == "Tree3" ) return OBJECT_TREE3; + if(value == "Tree4" ) return OBJECT_TREE4; + if(value == "Tree5" ) return OBJECT_TREE5; + if(value == "Mushroom1" ) return OBJECT_MUSHROOM1; + if(value == "Mushroom2" ) return OBJECT_MUSHROOM2; + if(value == "Home" ) return OBJECT_HOME1; + if(value == "Derrick" ) return OBJECT_DERRICK; + if(value == "BotFactory" ) return OBJECT_FACTORY; + if(value == "PowerStation" ) return OBJECT_STATION; + if(value == "Converter" ) return OBJECT_CONVERT; + if(value == "RepairCenter" ) return OBJECT_REPAIR; + if(value == "Destroyer" ) return OBJECT_DESTROYER; + if(value == "DefenseTower" ) return OBJECT_TOWER; + if(value == "AlienNest" ) return OBJECT_NEST; + if(value == "ResearchCenter" ) return OBJECT_RESEARCH; + if(value == "RadarStation" ) return OBJECT_RADAR; + if(value == "ExchangePost" ) return OBJECT_INFO; + if(value == "PowerPlant" ) return OBJECT_ENERGY; + if(value == "AutoLab" ) return OBJECT_LABO; + if(value == "NuclearPlant" ) return OBJECT_NUCLEAR; + if(value == "PowerCaptor" ) return OBJECT_PARA; + if(value == "Vault" ) return OBJECT_SAFE; + if(value == "Houston" ) return OBJECT_HUSTON; + if(value == "Target1" ) return OBJECT_TARGET1; + if(value == "Target2" ) return OBJECT_TARGET2; + if(value == "StartArea" ) return OBJECT_START; + if(value == "GoalArea" ) return OBJECT_END; + if(value == "AlienQueen" ) return OBJECT_MOTHER; + if(value == "AlienEgg" ) return OBJECT_EGG; + if(value == "AlienAnt" ) return OBJECT_ANT; + if(value == "AlienSpider" ) return OBJECT_SPIDER; + if(value == "AlienWasp" ) return OBJECT_BEE; + if(value == "AlienWorm" ) return OBJECT_WORM; + if(value == "WreckBotw1" ) return OBJECT_RUINmobilew1; + if(value == "WreckBotw2" ) return OBJECT_RUINmobilew2; + if(value == "WreckBott1" ) return OBJECT_RUINmobilet1; + if(value == "WreckBott2" ) return OBJECT_RUINmobilet2; + if(value == "WreckBotr1" ) return OBJECT_RUINmobiler1; + if(value == "WreckBotr2" ) return OBJECT_RUINmobiler2; + if(value == "RuinBotFactory" ) return OBJECT_RUINfactory; + if(value == "RuinDoor" ) return OBJECT_RUINdoor; + if(value == "RuinSupport" ) return OBJECT_RUINsupport; + if(value == "RuinRadar" ) return OBJECT_RUINradar; + if(value == "RuinConvert" ) return OBJECT_RUINconvert; + if(value == "RuinBaseCamp" ) return OBJECT_RUINbase; + if(value == "RuinHeadCamp" ) return OBJECT_RUINhead; + if(value == "Barrier0" ) return OBJECT_BARRIER0; + if(value == "Barrier1" ) return OBJECT_BARRIER1; + if(value == "Barrier2" ) return OBJECT_BARRIER2; + if(value == "Barrier3" ) return OBJECT_BARRIER3; + if(value == "Teen0" ) return OBJECT_TEEN0; + if(value == "Teen1" ) return OBJECT_TEEN1; + if(value == "Teen2" ) return OBJECT_TEEN2; + if(value == "Teen3" ) return OBJECT_TEEN3; + if(value == "Teen4" ) return OBJECT_TEEN4; + if(value == "Teen5" ) return OBJECT_TEEN5; + if(value == "Teen6" ) return OBJECT_TEEN6; + if(value == "Teen7" ) return OBJECT_TEEN7; + if(value == "Teen8" ) return OBJECT_TEEN8; + if(value == "Teen9" ) return OBJECT_TEEN9; + if(value == "Teen10" ) return OBJECT_TEEN10; + if(value == "Teen11" ) return OBJECT_TEEN11; + if(value == "Teen12" ) return OBJECT_TEEN12; + if(value == "Teen13" ) return OBJECT_TEEN13; + if(value == "Teen14" ) return OBJECT_TEEN14; + if(value == "Teen15" ) return OBJECT_TEEN15; + if(value == "Teen16" ) return OBJECT_TEEN16; + if(value == "Teen17" ) return OBJECT_TEEN17; + if(value == "Teen18" ) return OBJECT_TEEN18; + if(value == "Teen19" ) return OBJECT_TEEN19; + if(value == "Teen20" ) return OBJECT_TEEN20; + if(value == "Teen21" ) return OBJECT_TEEN21; + if(value == "Teen22" ) return OBJECT_TEEN22; + if(value == "Teen23" ) return OBJECT_TEEN23; + if(value == "Teen24" ) return OBJECT_TEEN24; + if(value == "Teen25" ) return OBJECT_TEEN25; + if(value == "Teen26" ) return OBJECT_TEEN26; + if(value == "Teen27" ) return OBJECT_TEEN27; + if(value == "Teen28" ) return OBJECT_TEEN28; + if(value == "Teen29" ) return OBJECT_TEEN29; + if(value == "Teen30" ) return OBJECT_TEEN30; + if(value == "Teen31" ) return OBJECT_TEEN31; + if(value == "Teen32" ) return OBJECT_TEEN32; + if(value == "Teen33" ) return OBJECT_TEEN33; + if(value == "Stone" ) return OBJECT_TEEN34; + if(value == "Teen35" ) return OBJECT_TEEN35; + if(value == "Teen36" ) return OBJECT_TEEN36; + if(value == "Teen37" ) return OBJECT_TEEN37; + if(value == "Teen38" ) return OBJECT_TEEN38; + if(value == "Teen39" ) return OBJECT_TEEN39; + if(value == "Teen40" ) return OBJECT_TEEN40; + if(value == "Teen41" ) return OBJECT_TEEN41; + if(value == "Teen42" ) return OBJECT_TEEN42; + if(value == "Teen43" ) return OBJECT_TEEN43; + if(value == "Teen44" ) return OBJECT_TEEN44; + if(value == "Quartz0" ) return OBJECT_QUARTZ0; + if(value == "Quartz1" ) return OBJECT_QUARTZ1; + if(value == "Quartz2" ) return OBJECT_QUARTZ2; + if(value == "Quartz3" ) return OBJECT_QUARTZ3; + if(value == "MegaStalk0" ) return OBJECT_ROOT0; + if(value == "MegaStalk1" ) return OBJECT_ROOT1; + if(value == "MegaStalk2" ) return OBJECT_ROOT2; + if(value == "MegaStalk3" ) return OBJECT_ROOT3; + if(value == "MegaStalk4" ) return OBJECT_ROOT4; + if(value == "MegaStalk5" ) return OBJECT_ROOT5; + if(value == "ApolloLEM" ) return OBJECT_APOLLO1; + if(value == "ApolloJeep" ) return OBJECT_APOLLO2; + if(value == "ApolloFlag" ) return OBJECT_APOLLO3; + if(value == "ApolloModule" ) return OBJECT_APOLLO4; + if(value == "ApolloAntenna" ) return OBJECT_APOLLO5; + if(value == "Me" ) return OBJECT_HUMAN; + if(value == "Tech" ) return OBJECT_TECH; + if(value == "MissionController" ) return OBJECT_CONTROLLER; + return static_cast<ObjectType>(Cast<int>(value, "object")); +} + +const std::string CLevelParserParam::FromObjectType(ObjectType value) +{ + if(value == OBJECT_PORTICO ) return "Portico"; + if(value == OBJECT_BASE ) return "SpaceShip"; + if(value == OBJECT_MOBILEwt ) return "PracticeBot"; + if(value == OBJECT_MOBILEfa ) return "WingedGrabber"; + if(value == OBJECT_MOBILEta ) return "TrackedGrabber"; + if(value == OBJECT_MOBILEwa ) return "WheeledGrabber"; + if(value == OBJECT_MOBILEia ) return "LeggedGrabber"; + if(value == OBJECT_MOBILEfc ) return "WingedShooter"; + if(value == OBJECT_MOBILEtc ) return "TrackedShooter"; + if(value == OBJECT_MOBILEwc ) return "WheeledShooter"; + if(value == OBJECT_MOBILEic ) return "LeggedShooter"; + if(value == OBJECT_MOBILEfi ) return "WingedOrgaShooter"; + if(value == OBJECT_MOBILEti ) return "TrackedOrgaShooter"; + if(value == OBJECT_MOBILEwi ) return "WheeledOrgaShooter"; + if(value == OBJECT_MOBILEii ) return "LeggedOrgaShooter"; + if(value == OBJECT_MOBILEfs ) return "WingedSniffer"; + if(value == OBJECT_MOBILEts ) return "TrackedSniffer"; + if(value == OBJECT_MOBILEws ) return "WheeledSniffer"; + if(value == OBJECT_MOBILEis ) return "LeggedSniffer"; + if(value == OBJECT_MOBILErt ) return "Thumper"; + if(value == OBJECT_MOBILErc ) return "PhazerShooter"; + if(value == OBJECT_MOBILErr ) return "Recycler"; + if(value == OBJECT_MOBILErs ) return "Shielder"; + if(value == OBJECT_MOBILEsa ) return "Subber"; + if(value == OBJECT_MOBILEtg ) return "TargetBot"; + if(value == OBJECT_MOBILEdr ) return "Scribbler"; + if(value == OBJECT_MARKPOWER ) return "PowerSpot"; + if(value == OBJECT_MARKSTONE ) return "TitaniumSpot"; + if(value == OBJECT_MARKURANIUM ) return "UraniumSpot"; + if(value == OBJECT_MARKKEYa ) return "KeyASpot"; + if(value == OBJECT_MARKKEYb ) return "KeyBSpot"; + if(value == OBJECT_MARKKEYc ) return "KeyCSpot"; + if(value == OBJECT_MARKKEYd ) return "KeyDSpot"; + if(value == OBJECT_WAYPOINT ) return "WayPoint"; + if(value == OBJECT_FLAGb ) return "BlueFlag"; + if(value == OBJECT_FLAGr ) return "RedFlag"; + if(value == OBJECT_FLAGg ) return "GreenFlag"; + if(value == OBJECT_FLAGy ) return "YellowFlag"; + if(value == OBJECT_FLAGv ) return "VioletFlag"; + if(value == OBJECT_POWER ) return "PowerCell"; + if(value == OBJECT_ATOMIC ) return "NuclearCell"; + if(value == OBJECT_STONE ) return "TitaniumOre"; + if(value == OBJECT_URANIUM ) return "UraniumOre"; + if(value == OBJECT_METAL ) return "Titanium"; + if(value == OBJECT_BULLET ) return "OrgaMatter"; + if(value == OBJECT_BBOX ) return "BlackBox"; + if(value == OBJECT_KEYa ) return "KeyA"; + if(value == OBJECT_KEYb ) return "KeyB"; + if(value == OBJECT_KEYc ) return "KeyC"; + if(value == OBJECT_KEYd ) return "KeyD"; + if(value == OBJECT_TNT ) return "TNT"; + if(value == OBJECT_SCRAP1 ) return "Scrap1"; + if(value == OBJECT_SCRAP2 ) return "Scrap2"; + if(value == OBJECT_SCRAP3 ) return "Scrap3"; + if(value == OBJECT_SCRAP4 ) return "Scrap4"; + if(value == OBJECT_SCRAP5 ) return "Scrap5"; + if(value == OBJECT_BOMB ) return "Mine"; + if(value == OBJECT_WINFIRE ) return "Firework"; + if(value == OBJECT_BAG ) return "Bag"; + if(value == OBJECT_PLANT0 ) return "Greenery0"; + if(value == OBJECT_PLANT1 ) return "Greenery1"; + if(value == OBJECT_PLANT2 ) return "Greenery2"; + if(value == OBJECT_PLANT3 ) return "Greenery3"; + if(value == OBJECT_PLANT4 ) return "Greenery4"; + if(value == OBJECT_PLANT5 ) return "Greenery5"; + if(value == OBJECT_PLANT6 ) return "Greenery6"; + if(value == OBJECT_PLANT7 ) return "Greenery7"; + if(value == OBJECT_PLANT8 ) return "Greenery8"; + if(value == OBJECT_PLANT9 ) return "Greenery9"; + if(value == OBJECT_PLANT10 ) return "Greenery10"; + if(value == OBJECT_PLANT11 ) return "Greenery11"; + if(value == OBJECT_PLANT12 ) return "Greenery12"; + if(value == OBJECT_PLANT13 ) return "Greenery13"; + if(value == OBJECT_PLANT14 ) return "Greenery14"; + if(value == OBJECT_PLANT15 ) return "Greenery15"; + if(value == OBJECT_PLANT16 ) return "Greenery16"; + if(value == OBJECT_PLANT17 ) return "Greenery17"; + if(value == OBJECT_PLANT18 ) return "Greenery18"; + if(value == OBJECT_PLANT19 ) return "Greenery19"; + if(value == OBJECT_TREE0 ) return "Tree0"; + if(value == OBJECT_TREE1 ) return "Tree1"; + if(value == OBJECT_TREE2 ) return "Tree2"; + if(value == OBJECT_TREE3 ) return "Tree3"; + if(value == OBJECT_TREE4 ) return "Tree4"; + if(value == OBJECT_TREE5 ) return "Tree5"; + if(value == OBJECT_MUSHROOM1 ) return "Mushroom1"; + if(value == OBJECT_MUSHROOM2 ) return "Mushroom2"; + if(value == OBJECT_HOME1 ) return "Home"; + if(value == OBJECT_DERRICK ) return "Derrick"; + if(value == OBJECT_FACTORY ) return "BotFactory"; + if(value == OBJECT_STATION ) return "PowerStation"; + if(value == OBJECT_CONVERT ) return "Converter"; + if(value == OBJECT_REPAIR ) return "RepairCenter"; + if(value == OBJECT_DESTROYER ) return "Destroyer"; + if(value == OBJECT_TOWER ) return "DefenseTower"; + if(value == OBJECT_NEST ) return "AlienNest"; + if(value == OBJECT_RESEARCH ) return "ResearchCenter"; + if(value == OBJECT_RADAR ) return "RadarStation"; + if(value == OBJECT_INFO ) return "ExchangePost"; + if(value == OBJECT_ENERGY ) return "PowerPlant"; + if(value == OBJECT_LABO ) return "AutoLab"; + if(value == OBJECT_NUCLEAR ) return "NuclearPlant"; + if(value == OBJECT_PARA ) return "PowerCaptor"; + if(value == OBJECT_SAFE ) return "Vault"; + if(value == OBJECT_HUSTON ) return "Houston"; + if(value == OBJECT_TARGET1 ) return "Target1"; + if(value == OBJECT_TARGET2 ) return "Target2"; + if(value == OBJECT_START ) return "StartArea"; + if(value == OBJECT_END ) return "GoalArea"; + if(value == OBJECT_MOTHER ) return "AlienQueen"; + if(value == OBJECT_EGG ) return "AlienEgg"; + if(value == OBJECT_ANT ) return "AlienAnt"; + if(value == OBJECT_SPIDER ) return "AlienSpider"; + if(value == OBJECT_BEE ) return "AlienWasp"; + if(value == OBJECT_WORM ) return "AlienWorm"; + if(value == OBJECT_RUINmobilew1) return "WreckBotw1"; + if(value == OBJECT_RUINmobilew2) return "WreckBotw2"; + if(value == OBJECT_RUINmobilet1) return "WreckBott1"; + if(value == OBJECT_RUINmobilet2) return "WreckBott2"; + if(value == OBJECT_RUINmobiler1) return "WreckBotr1"; + if(value == OBJECT_RUINmobiler2) return "WreckBotr2"; + if(value == OBJECT_RUINfactory ) return "RuinBotFactory"; + if(value == OBJECT_RUINdoor ) return "RuinDoor"; + if(value == OBJECT_RUINsupport ) return "RuinSupport"; + if(value == OBJECT_RUINradar ) return "RuinRadar"; + if(value == OBJECT_RUINconvert ) return "RuinConvert"; + if(value == OBJECT_RUINbase ) return "RuinBaseCamp"; + if(value == OBJECT_RUINhead ) return "RuinHeadCamp"; + if(value == OBJECT_BARRIER0 ) return "Barrier0"; + if(value == OBJECT_BARRIER1 ) return "Barrier1"; + if(value == OBJECT_BARRIER2 ) return "Barrier2"; + if(value == OBJECT_BARRIER3 ) return "Barrier3"; + if(value == OBJECT_TEEN0 ) return "Teen0"; + if(value == OBJECT_TEEN1 ) return "Teen1"; + if(value == OBJECT_TEEN2 ) return "Teen2"; + if(value == OBJECT_TEEN3 ) return "Teen3"; + if(value == OBJECT_TEEN4 ) return "Teen4"; + if(value == OBJECT_TEEN5 ) return "Teen5"; + if(value == OBJECT_TEEN6 ) return "Teen6"; + if(value == OBJECT_TEEN7 ) return "Teen7"; + if(value == OBJECT_TEEN8 ) return "Teen8"; + if(value == OBJECT_TEEN9 ) return "Teen9"; + if(value == OBJECT_TEEN10 ) return "Teen10"; + if(value == OBJECT_TEEN11 ) return "Teen11"; + if(value == OBJECT_TEEN12 ) return "Teen12"; + if(value == OBJECT_TEEN13 ) return "Teen13"; + if(value == OBJECT_TEEN14 ) return "Teen14"; + if(value == OBJECT_TEEN15 ) return "Teen15"; + if(value == OBJECT_TEEN16 ) return "Teen16"; + if(value == OBJECT_TEEN17 ) return "Teen17"; + if(value == OBJECT_TEEN18 ) return "Teen18"; + if(value == OBJECT_TEEN19 ) return "Teen19"; + if(value == OBJECT_TEEN20 ) return "Teen20"; + if(value == OBJECT_TEEN21 ) return "Teen21"; + if(value == OBJECT_TEEN22 ) return "Teen22"; + if(value == OBJECT_TEEN23 ) return "Teen23"; + if(value == OBJECT_TEEN24 ) return "Teen24"; + if(value == OBJECT_TEEN25 ) return "Teen25"; + if(value == OBJECT_TEEN26 ) return "Teen26"; + if(value == OBJECT_TEEN27 ) return "Teen27"; + if(value == OBJECT_TEEN28 ) return "Teen28"; + if(value == OBJECT_TEEN29 ) return "Teen29"; + if(value == OBJECT_TEEN30 ) return "Teen30"; + if(value == OBJECT_TEEN31 ) return "Teen31"; + if(value == OBJECT_TEEN32 ) return "Teen32"; + if(value == OBJECT_TEEN33 ) return "Teen33"; + if(value == OBJECT_TEEN34 ) return "Stone"; + if(value == OBJECT_TEEN35 ) return "Teen35"; + if(value == OBJECT_TEEN36 ) return "Teen36"; + if(value == OBJECT_TEEN37 ) return "Teen37"; + if(value == OBJECT_TEEN38 ) return "Teen38"; + if(value == OBJECT_TEEN39 ) return "Teen39"; + if(value == OBJECT_TEEN40 ) return "Teen40"; + if(value == OBJECT_TEEN41 ) return "Teen41"; + if(value == OBJECT_TEEN42 ) return "Teen42"; + if(value == OBJECT_TEEN43 ) return "Teen43"; + if(value == OBJECT_TEEN44 ) return "Teen44"; + if(value == OBJECT_QUARTZ0 ) return "Quartz0"; + if(value == OBJECT_QUARTZ1 ) return "Quartz1"; + if(value == OBJECT_QUARTZ2 ) return "Quartz2"; + if(value == OBJECT_QUARTZ3 ) return "Quartz3"; + if(value == OBJECT_ROOT0 ) return "MegaStalk0"; + if(value == OBJECT_ROOT1 ) return "MegaStalk1"; + if(value == OBJECT_ROOT2 ) return "MegaStalk2"; + if(value == OBJECT_ROOT3 ) return "MegaStalk3"; + if(value == OBJECT_ROOT4 ) return "MegaStalk4"; + if(value == OBJECT_ROOT5 ) return "MegaStalk5"; + if(value == OBJECT_APOLLO1 ) return "ApolloLEM"; + if(value == OBJECT_APOLLO2 ) return "ApolloJeep"; + if(value == OBJECT_APOLLO3 ) return "ApolloFlag"; + if(value == OBJECT_APOLLO4 ) return "ApolloModule"; + if(value == OBJECT_APOLLO5 ) return "ApolloAntenna"; + if(value == OBJECT_HUMAN ) return "Me"; + if(value == OBJECT_TECH ) return "Tech"; + if(value == OBJECT_CONTROLLER ) return "MissionController"; + return boost::lexical_cast<std::string>(static_cast<int>(value)); +} + +ObjectType CLevelParserParam::AsObjectType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToObjectType(m_value); +} + +ObjectType CLevelParserParam::AsObjectType(ObjectType def) +{ + if(m_empty) + return def; + return AsObjectType(); +} + + +DriveType CLevelParserParam::ToDriveType(std::string value) +{ + if(value == "Wheeled") return DRIVE_WHEELED; + if(value == "Tracked") return DRIVE_TRACKED; + if(value == "Winged" ) return DRIVE_WINGED; + if(value == "Legged" ) return DRIVE_LEGGED; + if(value == "Other" ) return DRIVE_OTHER; + return static_cast<DriveType>(Cast<int>(value, "drive")); +} + +DriveType CLevelParserParam::AsDriveType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToDriveType(m_value); +} + +DriveType CLevelParserParam::AsDriveType(DriveType def) +{ + if(m_empty) + return def; + return AsDriveType(); +} + + +ToolType CLevelParserParam::ToToolType(std::string value) +{ + if(value == "Grabber" ) return TOOL_GRABBER; + if(value == "Shiffer" ) return TOOL_SNIFFER; + if(value == "Shooter" ) return TOOL_SHOOTER; + if(value == "OrgaShooter") return TOOL_ORGASHOOTER; + if(value == "Other" ) return TOOL_OTHER; + return static_cast<ToolType>(Cast<int>(value, "tool")); +} + +ToolType CLevelParserParam::AsToolType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToToolType(m_value); +} + +ToolType CLevelParserParam::AsToolType(ToolType def) +{ + if(m_empty) + return def; + return AsToolType(); +} + + +Gfx::WaterType CLevelParserParam::ToWaterType(std::string value) +{ + if(value == "NULL") return Gfx::WATER_NULL; + if(value == "TT" ) return Gfx::WATER_TT; + if(value == "TO" ) return Gfx::WATER_TO; + if(value == "CT" ) return Gfx::WATER_CT; + if(value == "CO" ) return Gfx::WATER_CO; + return static_cast<Gfx::WaterType>(Cast<int>(value, "watertype")); +} + +Gfx::WaterType CLevelParserParam::AsWaterType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToWaterType(m_value); +} + +Gfx::WaterType CLevelParserParam::AsWaterType(Gfx::WaterType def) +{ + if(m_empty) + return def; + return AsWaterType(); +} + + +Gfx::EngineObjectType CLevelParserParam::ToTerrainType(std::string value) +{ + if(value == "Terrain") return Gfx::ENG_OBJTYPE_TERRAIN; + if(value == "Object" ) return Gfx::ENG_OBJTYPE_FIX; + if(value == "Quartz" ) return Gfx::ENG_OBJTYPE_QUARTZ; + if(value == "Metal" ) return Gfx::ENG_OBJTYPE_METAL; + return static_cast<Gfx::EngineObjectType>(Cast<int>(value, "terraintype")); +} + +Gfx::EngineObjectType CLevelParserParam::AsTerrainType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToTerrainType(m_value); +} + +Gfx::EngineObjectType CLevelParserParam::AsTerrainType(Gfx::EngineObjectType def) +{ + if(m_empty) + return def; + return AsTerrainType(); +} + + +int CLevelParserParam::ToBuildFlag(std::string value) +{ + if(value == "BotFactory" ) return BUILD_FACTORY; + if(value == "Derrick" ) return BUILD_DERRICK; + if(value == "Converter" ) return BUILD_CONVERT; + if(value == "RadarStation" ) return BUILD_RADAR; + if(value == "PowerPlant" ) return BUILD_ENERGY; + if(value == "NuclearPlant" ) return BUILD_NUCLEAR; + if(value == "FuelCellPlant" ) return BUILD_NUCLEAR; + if(value == "PowerStation" ) return BUILD_STATION; + if(value == "RepairCenter" ) return BUILD_REPAIR; + if(value == "DefenseTower" ) return BUILD_TOWER; + if(value == "ResearchCenter") return BUILD_RESEARCH; + if(value == "AutoLab" ) return BUILD_LABO; + if(value == "PowerCaptor" ) return BUILD_PARA; + if(value == "ExchangePost" ) return BUILD_INFO; + if(value == "Destroyer" ) return BUILD_DESTROYER; + if(value == "FlatGround" ) return BUILD_GFLAT; + if(value == "Flag" ) return BUILD_FLAG; + return Cast<int>(value, "buildflag"); +} + +int CLevelParserParam::AsBuildFlag() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToBuildFlag(m_value); +} + +int CLevelParserParam::AsBuildFlag(int def) +{ + if(m_empty) + return def; + return AsBuildFlag(); +} + + +int CLevelParserParam::ToResearchFlag(std::string value) +{ + if(value == "TRACKER" ) return RESEARCH_TANK; + if(value == "WINGER" ) return RESEARCH_FLY; + if(value == "THUMPER" ) return RESEARCH_THUMP; + if(value == "SHOOTER" ) return RESEARCH_CANON; + if(value == "TOWER" ) return RESEARCH_TOWER; + if(value == "PHAZER" ) return RESEARCH_PHAZER; + if(value == "SHIELDER") return RESEARCH_SHIELD; + if(value == "ATOMIC" ) return RESEARCH_ATOMIC; + if(value == "iPAW" ) return RESEARCH_iPAW; + if(value == "iGUN" ) return RESEARCH_iGUN; + if(value == "RECYCLER") return RESEARCH_RECYCLER; + if(value == "SUBBER" ) return RESEARCH_SUBM; + if(value == "SNIFFER" ) return RESEARCH_SNIFFER; + return Cast<int>(value, "researchflag"); +} + +int CLevelParserParam::AsResearchFlag() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToResearchFlag(m_value); +} + +int CLevelParserParam::AsResearchFlag(int def) +{ + if(m_empty) + return def; + return AsResearchFlag(); +} + + +Gfx::PyroType CLevelParserParam::ToPyroType(std::string value) +{ + if(value == "FRAGt" ) return Gfx::PT_FRAGT; + if(value == "FRAGo" ) return Gfx::PT_FRAGO; + if(value == "FRAGw" ) return Gfx::PT_FRAGW; + if(value == "EXPLOt") return Gfx::PT_EXPLOT; + if(value == "EXPLOo") return Gfx::PT_EXPLOO; + if(value == "EXPLOw") return Gfx::PT_EXPLOW; + if(value == "SHOTt" ) return Gfx::PT_SHOTT; + if(value == "SHOTh" ) return Gfx::PT_SHOTH; + if(value == "SHOTm" ) return Gfx::PT_SHOTM; + if(value == "SHOTw" ) return Gfx::PT_SHOTW; + if(value == "EGG" ) return Gfx::PT_EGG; + if(value == "BURNt" ) return Gfx::PT_BURNT; + if(value == "BURNo" ) return Gfx::PT_BURNO; + if(value == "SPIDER") return Gfx::PT_SPIDER; + if(value == "FALL" ) return Gfx::PT_FALL; + if(value == "RESET" ) return Gfx::PT_RESET; + if(value == "WIN" ) return Gfx::PT_WIN; + if(value == "LOST" ) return Gfx::PT_LOST; + return static_cast<Gfx::PyroType>(Cast<int>(value, "pyrotype")); +} + +Gfx::PyroType CLevelParserParam::AsPyroType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToPyroType(m_value); +} + +Gfx::PyroType CLevelParserParam::AsPyroType(Gfx::PyroType def) +{ + if(m_empty) + return def; + return AsPyroType(); +} + + +Gfx::CameraType CLevelParserParam::ToCameraType(std::string value) +{ + if(value == "BACK" ) return Gfx::CAM_TYPE_BACK; + if(value == "PLANE" ) return Gfx::CAM_TYPE_PLANE; + if(value == "ONBOARD") return Gfx::CAM_TYPE_ONBOARD; + if(value == "FIX" ) return Gfx::CAM_TYPE_FIX; + return static_cast<Gfx::CameraType>(Cast<int>(value, "camera")); +} + +const std::string CLevelParserParam::FromCameraType(Gfx::CameraType value) +{ + if(value == Gfx::CAM_TYPE_ONBOARD) return "ONBOARD"; + if(value == Gfx::CAM_TYPE_FIX ) return "FIX"; + return boost::lexical_cast<std::string>(static_cast<int>(value)); +} + +Gfx::CameraType CLevelParserParam::AsCameraType() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + return ToCameraType(m_value); +} + +Gfx::CameraType CLevelParserParam::AsCameraType(Gfx::CameraType def) +{ + if(m_empty) + return def; + return AsCameraType(); +} + + +void CLevelParserParam::ParseArray() +{ + if(m_array.size() != 0) + return; + + std::vector<std::string> values; + boost::split(values, m_value, boost::is_any_of(";")); + int i = 0; + for(auto& value : values) { + boost::algorithm::trim(value); + if(value.empty()) continue; + CLevelParserParam* param = new CLevelParserParam(m_name+"["+boost::lexical_cast<std::string>(i)+"]", value); + param->SetLine(m_line); + m_array.push_back(param); + i++; + } +} + +const std::vector<CLevelParserParam*>& CLevelParserParam::AsArray() +{ + if(m_empty) + throw CLevelParserExceptionMissingParam(this); + + ParseArray(); + + return m_array; +}
\ No newline at end of file diff --git a/src/object/level/parserparam.h b/src/object/level/parserparam.h new file mode 100644 index 0000000..f59b40f --- /dev/null +++ b/src/object/level/parserparam.h @@ -0,0 +1,137 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ + +/** + * \file object/level/parserparam.h + * \brief Value of command argument in level file + */ + +#pragma once + +#include <object/object.h> +#include <graphics/core/color.h> +#include <graphics/engine/water.h> +#include <graphics/engine/pyro.h> +#include <math/point.h> + +#include <string> + +class CLevelParserLine; + +class CLevelParserParam +{ +public: + //! Create param with given value + //@{ + CLevelParserParam(int value); + CLevelParserParam(float value); + CLevelParserParam(std::string value); + CLevelParserParam(bool value); + CLevelParserParam(Gfx::Color value); + CLevelParserParam(Math::Point value); + CLevelParserParam(ObjectType value); + CLevelParserParam(Gfx::CameraType value); + CLevelParserParam(const std::vector<CLevelParserParam*>& value); + //@} + //! Create param from string + CLevelParserParam(std::string name, std::string value); + //! Create empty parser param + CLevelParserParam(std::string name, bool empty); + + ~CLevelParserParam(); + + //! Get value (throws exception if not found or unable to process) + //@{ + int AsInt(); + float AsFloat(); + std::string AsString(); + bool AsBool(); + std::string AsPath(const std::string defaultDir); + Gfx::Color AsColor(); + Math::Vector AsPoint(); + ObjectType AsObjectType(); + DriveType AsDriveType(); + ToolType AsToolType(); + Gfx::WaterType AsWaterType(); + Gfx::EngineObjectType AsTerrainType(); + int AsBuildFlag(); + int AsResearchFlag(); + Gfx::PyroType AsPyroType(); + Gfx::CameraType AsCameraType(); + const std::vector<CLevelParserParam*>& AsArray(); + //@} + + //! Get value (returns default if not found, throws exception if unable to process) + //@{ + int AsInt(int def); + float AsFloat(float def); + std::string AsString(std::string def); + bool AsBool(bool def); + std::string AsPath(const std::string defaultDir, std::string def); + Gfx::Color AsColor(Gfx::Color def); + Math::Vector AsPoint(Math::Vector def); + ObjectType AsObjectType(ObjectType def); + DriveType AsDriveType(DriveType def); + ToolType AsToolType(ToolType def); + Gfx::WaterType AsWaterType(Gfx::WaterType def); + Gfx::EngineObjectType AsTerrainType(Gfx::EngineObjectType def); + int AsBuildFlag(int def); + int AsResearchFlag(int def); + Gfx::PyroType AsPyroType(Gfx::PyroType def); + Gfx::CameraType AsCameraType(Gfx::CameraType def); + //@} + + //! Set line this param is part of + void SetLine(CLevelParserLine* line); + //! Get line this param is part of + CLevelParserLine* GetLine(); + + std::string GetName(); + std::string GetValue(); + bool IsDefined(); + + static std::string InjectLevelDir(std::string path, const std::string defaultDir); + +private: + void ParseArray(); + + template<typename T> T Cast(std::string value, std::string requestedType); + template<typename T> T Cast(std::string requestedType); + + std::string ToPath(std::string path, const std::string defaultDir); + ObjectType ToObjectType(std::string value); + DriveType ToDriveType(std::string value); + ToolType ToToolType(std::string value); + Gfx::WaterType ToWaterType(std::string value); + Gfx::EngineObjectType ToTerrainType(std::string value); + int ToBuildFlag(std::string value); + int ToResearchFlag(std::string value); + Gfx::PyroType ToPyroType(std::string value); + Gfx::CameraType ToCameraType(std::string value); + + const std::string FromObjectType(ObjectType value); + const std::string FromCameraType(Gfx::CameraType value); + +private: + CLevelParserLine* m_line; + bool m_empty; + std::string m_name; + std::string m_value; + std::vector<CLevelParserParam*> m_array; +};
\ No newline at end of file diff --git a/src/object/mainmovie.cpp b/src/object/mainmovie.cpp index 85abee2..1459cf4 100644 --- a/src/object/mainmovie.cpp +++ b/src/object/mainmovie.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/mainmovie.h" diff --git a/src/object/mainmovie.h b/src/object/mainmovie.h index 4554431..c4fc79a 100644 --- a/src/object/mainmovie.h +++ b/src/object/mainmovie.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file object/mainmovie.h diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp index 00b3073..6693317 100644 --- a/src/object/motion/motion.cpp +++ b/src/object/motion/motion.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motion.h" diff --git a/src/object/motion/motion.h b/src/object/motion/motion.h index d35ee67..81350b7 100644 --- a/src/object/motion/motion.h +++ b/src/object/motion/motion.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motion.h diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp index 16e53aa..6ca0707 100644 --- a/src/object/motion/motionant.cpp +++ b/src/object/motion/motionant.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionant.h" diff --git a/src/object/motion/motionant.h b/src/object/motion/motionant.h index 45d02b3..660418a 100644 --- a/src/object/motion/motionant.h +++ b/src/object/motion/motionant.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionant.h diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp index 2a052b2..07e295a 100644 --- a/src/object/motion/motionbee.cpp +++ b/src/object/motion/motionbee.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionbee.h" diff --git a/src/object/motion/motionbee.h b/src/object/motion/motionbee.h index c0347a0..a09ef3a 100644 --- a/src/object/motion/motionbee.h +++ b/src/object/motion/motionbee.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionbee.h diff --git a/src/object/motion/motiondummy.cpp b/src/object/motion/motiondummy.cpp index 86e389e..a3ba540 100644 --- a/src/object/motion/motiondummy.cpp +++ b/src/object/motion/motiondummy.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2013 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motiondummy.h" diff --git a/src/object/motion/motiondummy.h b/src/object/motion/motiondummy.h index 2cb3a88..a2c8460 100644 --- a/src/object/motion/motiondummy.h +++ b/src/object/motion/motiondummy.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2013 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motiondummy.h diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp index edee260..2c6005b 100644 --- a/src/object/motion/motionhuman.cpp +++ b/src/object/motion/motionhuman.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionhuman.h" diff --git a/src/object/motion/motionhuman.h b/src/object/motion/motionhuman.h index ddb0843..4eac403 100644 --- a/src/object/motion/motionhuman.h +++ b/src/object/motion/motionhuman.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionhuman.h diff --git a/src/object/motion/motionmother.cpp b/src/object/motion/motionmother.cpp index 03e7c21..161187e 100644 --- a/src/object/motion/motionmother.cpp +++ b/src/object/motion/motionmother.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionmother.h" diff --git a/src/object/motion/motionmother.h b/src/object/motion/motionmother.h index a6c7e93..13fe466 100644 --- a/src/object/motion/motionmother.h +++ b/src/object/motion/motionmother.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionmother.h diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp index 8d339b6..082ab51 100644 --- a/src/object/motion/motionspider.cpp +++ b/src/object/motion/motionspider.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionspider.h" diff --git a/src/object/motion/motionspider.h b/src/object/motion/motionspider.h index 89745c4..1a99bfd 100644 --- a/src/object/motion/motionspider.h +++ b/src/object/motion/motionspider.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionspider.h diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp index b4ed89d..ef3fb68 100644 --- a/src/object/motion/motiontoto.cpp +++ b/src/object/motion/motiontoto.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motiontoto.h" diff --git a/src/object/motion/motiontoto.h b/src/object/motion/motiontoto.h index 47baa28..a071781 100644 --- a/src/object/motion/motiontoto.h +++ b/src/object/motion/motiontoto.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motiontoto.h diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp index a67ae24..2197d6f 100644 --- a/src/object/motion/motionvehicle.cpp +++ b/src/object/motion/motionvehicle.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionvehicle.h" diff --git a/src/object/motion/motionvehicle.h b/src/object/motion/motionvehicle.h index ffb25ef..9342886 100644 --- a/src/object/motion/motionvehicle.h +++ b/src/object/motion/motionvehicle.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionvehicle.h diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp index 80bf7fc..073a962 100644 --- a/src/object/motion/motionworm.cpp +++ b/src/object/motion/motionworm.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/motion/motionworm.h" diff --git a/src/object/motion/motionworm.h b/src/object/motion/motionworm.h index 7684faf..5353bf2 100644 --- a/src/object/motion/motionworm.h +++ b/src/object/motion/motionworm.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // motionworm.h diff --git a/src/object/object.cpp b/src/object/object.cpp index 3c225d0..a64bcb5 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/object.h" diff --git a/src/object/object.h b/src/object/object.h index 0e469f2..9283c9b 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file object/object.h diff --git a/src/object/objman.cpp b/src/object/objman.cpp index b0bac1a..25f907a 100644 --- a/src/object/objman.cpp +++ b/src/object/objman.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/object.h" diff --git a/src/object/objman.h b/src/object/objman.h index 390587b..137cbc8 100644 --- a/src/object/objman.h +++ b/src/object/objman.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file object/objman.h diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 76c234d..1ad3c6d 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/robotmain.h" @@ -20,7 +23,6 @@ #include "CBot/CBotDll.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/event.h" #include "common/global.h" @@ -30,6 +32,8 @@ #include "common/profile.h" #include "common/restext.h" +#include "common/resources/inputstream.h" + #include "graphics/engine/camera.h" #include "graphics/engine/cloud.h" #include "graphics/engine/engine.h" @@ -57,6 +61,7 @@ #include "object/task/task.h" #include "object/task/taskbuild.h" #include "object/task/taskmanip.h" +#include "object/level/parser.h" #include "physics/physics.h" @@ -82,7 +87,7 @@ #include <iomanip> -#include <boost/regex.hpp> +#include <boost/lexical_cast.hpp> template<> CRobotMain* CSingleton<CRobotMain>::m_instance = nullptr; @@ -656,12 +661,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) m_selectObject = 0; m_infoUsed = 0; - m_beginObject = false; - m_terrainGenerate = false; - m_terrainInit = false; - m_terrainInitTextures = false; - m_terrainCreate = false; - m_version = 1; m_controller = nullptr; m_retroStyle = false; @@ -712,7 +711,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) FlushDisplayInfo(); - m_fontSize = 9.0f; + m_fontSize = 19.0f; m_windowPos = Math::Point(0.15f, 0.17f); m_windowDim = Math::Point(0.70f, 0.66f); @@ -721,11 +720,11 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) if (loadProfile) { - if (GetProfile().GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue; + if (GetProfile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue; + if (GetProfile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue; + if (GetProfile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue; + if (GetProfile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue; + if (GetProfile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue; } m_IOPublic = false; @@ -735,11 +734,11 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) if (loadProfile) { - if (GetProfile().GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue; - if (GetProfile().GetLocalProfileFloat("Edit", "IOPosX", fValue)) m_IOPos.x = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "IOPosY", fValue)) m_IOPos.y = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "IODimX", fValue)) m_IODim.x = fValue; - if (GetProfile().GetLocalProfileFloat("Edit", "IODimY", fValue)) m_IODim.y = fValue; + if (GetProfile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue; + if (GetProfile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue; + if (GetProfile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue; + if (GetProfile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue; + if (GetProfile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue; } m_short->FlushShortcuts(); @@ -757,7 +756,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) g_unit = UNIT; m_gamerName = ""; - if (loadProfile) GetProfile().GetLocalProfileString("Gamer", "LastName", m_gamerName); + if (loadProfile) GetProfile().GetStringProperty("Gamer", "LastName", m_gamerName); SetGlobalGamerName(m_gamerName); ReadFreeParam(); if (loadProfile) m_dialog->SetupRecall(); @@ -859,8 +858,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile) CBotProgram::DefineNum("ResearchSubber", RESEARCH_SUBM); CBotProgram::DefineNum("ResearchSniffer", RESEARCH_SNIFFER); -//? CBotProgram:: - CBotProgram::DefineNum("PolskiPortalColobota", 1337); CBotClass* bc; @@ -962,24 +959,38 @@ void CRobotMain::LoadSceneOnStart(const std::string& name, int rank) ChangePhase(PHASE_LOADING); } +void CRobotMain::ResetAfterDeviceChanged() +{ + if(m_phase == PHASE_SETUPds || + m_phase == PHASE_SETUPgs || + m_phase == PHASE_SETUPps || + m_phase == PHASE_SETUPcs || + m_phase == PHASE_SETUPss || + m_phase == PHASE_SIMUL || + m_phase == PHASE_WIN || + m_phase == PHASE_LOST) + ChangeColor(); + UpdateMap(); +} + //! Creates the file colobot.ini at the first time void CRobotMain::CreateIni() { m_dialog->SetupMemorize(); - GetProfile().SetLocalProfileFloat("Edit", "FontSize", m_fontSize); - GetProfile().SetLocalProfileFloat("Edit", "WindowPosX", m_windowPos.x); - GetProfile().SetLocalProfileFloat("Edit", "WindowPosY", m_windowPos.y); - GetProfile().SetLocalProfileFloat("Edit", "WindowDimX", m_windowDim.x); - GetProfile().SetLocalProfileFloat("Edit", "WindowDimY", m_windowDim.y); - GetProfile().SetLocalProfileInt("Edit", "IOPublic", m_IOPublic); - GetProfile().SetLocalProfileFloat("Edit", "IOPosX", m_IOPos.x); - GetProfile().SetLocalProfileFloat("Edit", "IOPosY", m_IOPos.y); - GetProfile().SetLocalProfileFloat("Edit", "IODimX", m_IODim.x); - GetProfile().SetLocalProfileFloat("Edit", "IODimY", m_IODim.y); + GetProfile().SetFloatProperty("Edit", "FontSize", m_fontSize); + GetProfile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x); + GetProfile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y); + GetProfile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x); + GetProfile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y); + GetProfile().SetIntProperty("Edit", "IOPublic", m_IOPublic); + GetProfile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x); + GetProfile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y); + GetProfile().SetFloatProperty("Edit", "IODimX", m_IODim.x); + GetProfile().SetFloatProperty("Edit", "IODimY", m_IODim.y); - GetProfile().SaveCurrentDirectory(); + GetProfile().Save(); } void CRobotMain::SetDefaultInputBindings() @@ -1209,26 +1220,27 @@ void CRobotMain::ChangePhase(Phase phase) bool loading = (m_dialog->GetSceneRead()[0] != 0); m_map->CreateMap(); - CreateScene(m_dialog->GetSceneSoluce(), false, false); // interactive scene - if (m_mapImage) - m_map->SetFixImage(m_mapFilename); - - m_app->ResetTimeAfterLoading(); - - /*Math::Point ddim; + + try { + CreateScene(m_dialog->GetSceneSoluce(), false, false); // interactive scene + if (m_mapImage) + m_map->SetFixImage(m_mapFilename); - pos.x = 620.0f/640.0f; - pos.y = 460.0f/480.0f; - ddim.x = 20.0f/640.0f; - ddim.y = 20.0f/480.0f; - m_interface->CreateButton(pos, ddim, 11, EVENT_BUTTON_QUIT);*/ + m_app->ResetTimeAfterLoading(); - if (m_immediatSatCom && !loading && - m_infoFilename[SATCOM_HUSTON][0] != 0) - StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions + if (m_immediatSatCom && !loading && + m_infoFilename[SATCOM_HUSTON][0] != 0) + StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions - m_sound->StopMusic(0.0f); - if (!m_base || loading) StartMusic(); + m_sound->StopMusic(0.0f); + if (!m_base || loading) StartMusic(); + } + catch(const CLevelParserException& e) + { + CLogger::GetInstancePointer()->Error("An error occured while trying to load a level\n"); + CLogger::GetInstancePointer()->Error("%s\n", e.what()); + ChangePhase(PHASE_INIT); + } } if (m_phase == PHASE_WIN) @@ -1244,29 +1256,37 @@ void CRobotMain::ChangePhase(Phase phase) m_dialog->SetSceneName("win"); m_dialog->SetSceneRank(m_endingWinRank); - CreateScene(false, true, false); // sets scene + try { + CreateScene(false, true, false); // sets scene - pos.x = ox+sx*1; pos.y = oy+sy*1; - Math::Point ddim; - ddim.x = dim.x*2; ddim.y = dim.y*2; - m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); + pos.x = ox+sx*1; pos.y = oy+sy*1; + Math::Point ddim; + ddim.x = dim.x*2; ddim.y = dim.y*2; + m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); - if (m_winTerminate) - { - pos.x = ox+sx*3; pos.y = oy+sy*0.2f; - ddim.x = dim.x*15; ddim.y = dim.y*3.0f; - pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0); - pe->SetGenericMode(true); - pe->SetFontType(Gfx::FONT_COLOBOT); - pe->SetEditCap(false); - pe->SetHighlightCap(false); - pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/win.txt")); + if (m_winTerminate) + { + pos.x = ox+sx*3; pos.y = oy+sy*0.2f; + ddim.x = dim.x*15; ddim.y = dim.y*3.0f; + pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0); + pe->SetGenericMode(true); + pe->SetFontType(Gfx::FONT_COLOBOT); + pe->SetEditCap(false); + pe->SetHighlightCap(false); + pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/win.txt")); + } + else + { + m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); + } + StartMusic(); } - else + catch(const CLevelParserException& e) { - m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); + CLogger::GetInstancePointer()->Error("An error occured while trying to load win scene\n"); + CLogger::GetInstancePointer()->Error("%s\n", e.what()); + ChangePhase(PHASE_TERM); } - StartMusic(); } } @@ -1282,15 +1302,23 @@ void CRobotMain::ChangePhase(Phase phase) m_winTerminate = false; m_dialog->SetSceneName("lost"); m_dialog->SetSceneRank(m_endingLostRank); - CreateScene(false, true, false); // sets scene + try { + CreateScene(false, true, false); // sets scene - pos.x = ox+sx*1; pos.y = oy+sy*1; - Math::Point ddim; - ddim.x = dim.x*2; ddim.y = dim.y*2; - m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); - m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); + pos.x = ox+sx*1; pos.y = oy+sy*1; + Math::Point ddim; + ddim.x = dim.x*2; ddim.y = dim.y*2; + m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK); + m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f); - StartMusic(); + StartMusic(); + } + catch(const CLevelParserException& e) + { + CLogger::GetInstancePointer()->Error("An error occured while trying to load lost scene\n"); + CLogger::GetInstancePointer()->Error("%s\n", e.what()); + ChangePhase(PHASE_TERM); + } } } @@ -1638,18 +1666,6 @@ bool CRobotMain::ProcessEvent(Event &event) m_cameraZoom = 0.0f; break; - case EVENT_BUTTON_QUIT: - if (m_movie->IsExist()) - StartDisplayInfo(SATCOM_HUSTON, false); - else if (m_winDelay > 0.0f) - ChangePhase(PHASE_WIN); - else if (m_lostDelay > 0.0f) - - ChangePhase(PHASE_LOST); - else - m_dialog->StartAbort(); // do you want to leave? - break; - case EVENT_OBJECT_LIMIT: StartShowLimit(); break; @@ -2189,12 +2205,6 @@ void CRobotMain::StartDisplayInfo(const char *filename, int index) m_sound->MuteAll(true); } - Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if (pb != nullptr) - { - pb->ClearState(Ui::STATE_VISIBLE); - } - bool soluce = m_dialog->GetSceneSoluce(); m_displayInfo = new Ui::CDisplayInfo(); @@ -2223,10 +2233,6 @@ void CRobotMain::StopDisplayInfo() if (!m_editLock) { - Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if (pb != nullptr) - pb->SetState(Ui::STATE_VISIBLE); - SelectObject(m_infoObject, false); // gives the command buttons m_displayText->HideText(false); @@ -2264,20 +2270,12 @@ void CRobotMain::StartSuspend() m_infoObject = DeselectAll(); // removes the control buttons m_displayText->HideText(true); - Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if (pb != nullptr) - pb->ClearState(Ui::STATE_VISIBLE); - m_suspend = true; } //! End of dialogue during the game void CRobotMain::StopSuspend() { - Ui::CButton* pb = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if (pb != nullptr) - pb->SetState(Ui::STATE_VISIBLE); - SelectObject(m_infoObject, false); // gives the command buttons m_map->ShowMap(m_mapShow); m_displayText->HideText(false); @@ -2298,7 +2296,7 @@ float CRobotMain::GetGameTime() void CRobotMain::SetFontSize(float size) { m_fontSize = size; - GetProfile().SetLocalProfileFloat("Edit", "FontSize", m_fontSize); + GetProfile().SetFloatProperty("Edit", "FontSize", m_fontSize); } float CRobotMain::GetFontSize() @@ -2310,8 +2308,8 @@ float CRobotMain::GetFontSize() void CRobotMain::SetWindowPos(Math::Point pos) { m_windowPos = pos; - GetProfile().SetLocalProfileFloat("Edit", "WindowPosX", m_windowPos.x); - GetProfile().SetLocalProfileFloat("Edit", "WindowPosY", m_windowPos.y); + GetProfile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x); + GetProfile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y); } Math::Point CRobotMain::GetWindowPos() @@ -2322,8 +2320,8 @@ Math::Point CRobotMain::GetWindowPos() void CRobotMain::SetWindowDim(Math::Point dim) { m_windowDim = dim; - GetProfile().SetLocalProfileFloat("Edit", "WindowDimX", m_windowDim.x); - GetProfile().SetLocalProfileFloat("Edit", "WindowDimY", m_windowDim.y); + GetProfile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x); + GetProfile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y); } Math::Point CRobotMain::GetWindowDim() @@ -2336,7 +2334,7 @@ Math::Point CRobotMain::GetWindowDim() void CRobotMain::SetIOPublic(bool mode) { m_IOPublic = mode; - GetProfile().SetLocalProfileInt("Edit", "IOPublic", m_IOPublic); + GetProfile().SetIntProperty("Edit", "IOPublic", m_IOPublic); } bool CRobotMain::GetIOPublic() @@ -2347,8 +2345,8 @@ bool CRobotMain::GetIOPublic() void CRobotMain::SetIOPos(Math::Point pos) { m_IOPos = pos; - GetProfile().SetLocalProfileFloat("Edit", "IOPosX", m_IOPos.x); - GetProfile().SetLocalProfileFloat("Edit", "IOPosY", m_IOPos.y); + GetProfile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x); + GetProfile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y); } Math::Point CRobotMain::GetIOPos() @@ -2359,8 +2357,8 @@ Math::Point CRobotMain::GetIOPos() void CRobotMain::SetIODim(Math::Point dim) { m_IODim = dim; - GetProfile().SetLocalProfileFloat("Edit", "IODimX", m_IODim.x); - GetProfile().SetLocalProfileFloat("Edit", "IODimY", m_IODim.y); + GetProfile().SetFloatProperty("Edit", "IODimX", m_IODim.x); + GetProfile().SetFloatProperty("Edit", "IODimY", m_IODim.y); } Math::Point CRobotMain::GetIODim() @@ -3643,199 +3641,6 @@ char* SkipNum(char *p) return p; } -//! Conversion of units -void CRobotMain::Convert() -{ - char* base = m_dialog->GetSceneName(); - int rank = m_dialog->GetSceneRank(); - - //TODO change line to string - char line[500]; - std::string tempLine; - - m_dialog->BuildSceneName(tempLine, base, rank); - strcpy(line, tempLine.c_str()); - FILE* file = fopen(line, "r"); - if (file == NULL) return; - - strcpy(line+strlen(line)-4, ".new"); - FILE* fileNew = fopen(line, "w"); - if (fileNew == NULL) return; - - char lineNew[500]; - char s[200]; - - while (fgets(line, 500, file) != NULL) - { - strcpy(lineNew, line); - - if (Cmd(line, "DeepView")) - { - char* p = strstr(line, "air="); - if (p != 0) - { - float value = OpFloat(line, "air", 500.0f); - value /= g_unit; - p[0] = 0; - p = SkipNum(p+4); - strcpy(lineNew, line); - strcat(lineNew, "air="); - sprintf(s, "%.2f", value); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - - p = strstr(line, "water="); - if (p != 0) - { - float value = OpFloat(line, "water", 100.0f); - value /= g_unit; - p[0] = 0; - p = SkipNum(p+6); - strcpy(lineNew, line); - strcat(lineNew, "water="); - sprintf(s, "%.2f", value); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - } - - if (Cmd(line, "TerrainGenerate")) - { - char* p = strstr(line, "vision="); - if (p != 0) - { - float value = OpFloat(line, "vision", 500.0f); - value /= g_unit; - p[0] = 0; - p = SkipNum(p+7); - strcpy(lineNew, line); - strcat(lineNew, "vision="); - sprintf(s, "%.2f", value); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - } - - if (Cmd(line, "CreateObject") || - Cmd(line, "CreateSpot")) - { - char* p = strstr(line, "pos="); - if (p != 0) - { - Math::Vector pos = OpPos(line, "pos"); - pos.x /= g_unit; - pos.y /= g_unit; - pos.z /= g_unit; - p[0] = 0; - p = SkipNum(p+4); - p = SkipNum(p+1); - strcpy(lineNew, line); - strcat(lineNew, "pos="); - sprintf(s, "%.2f", pos.x); - strcat(lineNew, s); - strcat(lineNew, ";"); - sprintf(s, "%.2f", pos.z); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - } - - if (Cmd(line, "EndMissionTake") || Cmd(line, "AudioChange")) - { - char* p = strstr(line, "pos="); - if (p != 0) - { - Math::Vector pos = OpPos(line, "pos"); - pos.x /= g_unit; - pos.y /= g_unit; - pos.z /= g_unit; - p[0] = 0; - p = SkipNum(p+4); - p = SkipNum(p+1); - strcpy(lineNew, line); - strcat(lineNew, "pos="); - sprintf(s, "%.2f", pos.x); - strcat(lineNew, s); - strcat(lineNew, ";"); - sprintf(s, "%.2f", pos.z); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - - p = strstr(line, "dist="); - if (p != 0) - { - float value = OpFloat(line, "dist", 32.0f); - value /= g_unit; - p[0] = 0; - p = SkipNum(p+5); - strcpy(lineNew, line); - strcat(lineNew, "dist="); - sprintf(s, "%.2f", value); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - } - - if (Cmd(line, "Camera")) - { - char* p = strstr(line, "pos="); - if (p != 0) - { - Math::Vector pos = OpPos(line, "pos"); - pos.x /= g_unit; - pos.y /= g_unit; - pos.z /= g_unit; - p[0] = 0; - p = SkipNum(p+4); - p = SkipNum(p+1); - strcpy(lineNew, line); - strcat(lineNew, "pos="); - sprintf(s, "%.2f", pos.x); - strcat(lineNew, s); - strcat(lineNew, ";"); - sprintf(s, "%.2f", pos.z); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - - p = strstr(line, "h="); - if (p != 0) - { - float value = OpFloat(line, "h", 32.0f); - value /= g_unit; - p[0] = 0; - p = SkipNum(p+2); - strcpy(lineNew, line); - strcat(lineNew, "h="); - sprintf(s, "%.2f", value); - strcat(lineNew, s); - strcat(lineNew, " "); - strcat(lineNew, p); - } - strcpy(line, lineNew); - } - - fputs(lineNew, fileNew); - } - - fclose(fileNew); - fclose(file); -} - //! Load the scene for the character void CRobotMain::ScenePerso() { @@ -3858,7 +3663,14 @@ void CRobotMain::ScenePerso() m_dialog->SetSceneName("perso"); m_dialog->SetSceneRank(0); - CreateScene(false, true, false); // sets scene + try { + CreateScene(false, true, false); // sets scene + } + catch(const CLevelParserException& e) + { + CLogger::GetInstancePointer()->Error("An error occured while trying to load apperance scene\n"); + CLogger::GetInstancePointer()->Error("%s\n", e.what()); + } m_engine->SetDrawWorld(false); // does not draw anything on the interface m_engine->SetDrawFront(true); // draws on the human interface @@ -3880,12 +3692,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) int rank = m_dialog->GetSceneRank(); const char* read = m_dialog->GetSceneRead().c_str(); const char* stack = m_dialog->GetStackRead().c_str(); - m_dialog->SetUserDir(base, rank); - - /* - * TODO: original code relying on UserDir() was removed. - * A new way of providing custom data file paths will need to be devised. - */ m_fixScene = fixScene; @@ -3957,35 +3763,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) strcpy(m_scriptName, scriptNameStr.c_str()); m_scriptFile[0] = 0; - m_beginObject = false; - m_terrainGenerate = false; - m_terrainInit = false; - m_terrainInitTextures = false; - m_terrainCreate = false; - m_version = 1; m_retroStyle = false; m_missionResult = ERR_MISSION_NOTERM; } - - char line[500]; - char name[200]; - char dir[100]; - char op[100]; - char filename[500]; - int lineNum = 0; - - memset(line, 0, 500); - memset(name, 0, 200); - memset(dir, 0, 100); - memset(op, 0, 100); - memset(filename, 0, 500); - std::string tempLine; - m_dialog->BuildSceneName(tempLine, base, rank); - strcpy(filename, tempLine.c_str()); - FILE* file = fopen(filename, "r"); - if (file == NULL) return; + + CLevelParser* level = new CLevelParser(base, rank/100, rank%100); + level->Load(); int rankObj = 0; int rankGadget = 0; @@ -3998,579 +3783,445 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) * may speed up loading */ - while (fgets(line, 500, file) != NULL) + for(auto& line : level->GetLines()) { - lineNum++; - for (int i = 0; i < 500; i++) + if (line->GetCommand() == "MissionFile" && !resetObject) { - if (line[i] == '\t' ) line[i] = ' '; // replace tab by space - if (line[i] == '/' && line[i+1] == '/') - { - line[i] = 0; - break; - } - } - - if (Cmd(line, "MissionFile") && !resetObject) { - m_version = OpInt(line, "version", 1); - continue; + m_version = line->GetParam("version")->AsInt(1); + continue; } - - // TODO: Fallback to an non-localized entry - sprintf(op, "Title.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) + + if(line->GetCommand() == "Title" && !resetObject) { - OpString(line, "text", m_title); + strcpy(m_title, line->GetParam("text")->AsString().c_str()); continue; } - - sprintf(op, "Resume.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) + + if(line->GetCommand() == "Resume" && !resetObject) { - OpString(line, "text", m_resume); + strcpy(m_resume, line->GetParam("text")->AsString().c_str()); continue; } - - sprintf(op, "ScriptName.%c", m_app->GetLanguageChar()); - if (Cmd(line, op) && !resetObject) + + if(line->GetCommand() == "ScriptName" && !resetObject) { - OpString(line, "text", m_scriptName); + strcpy(m_scriptName, line->GetParam("text")->AsString().c_str()); continue; } - - static const boost::regex titleCmdRe("Title\\.[A-Z]"); - static const boost::regex resumeCmdRe("Resume\\.[A-Z]"); - static const boost::regex scriptNameCmdRe("ScriptName\\.[A-Z]"); - - if (boost::regex_match(GetCmd(line), titleCmdRe)) continue; // Ignore - if (boost::regex_match(GetCmd(line), resumeCmdRe)) continue; // Ignore - if (boost::regex_match(GetCmd(line), scriptNameCmdRe)) continue; // Ignore - - - if (Cmd(line, "ScriptFile") && !resetObject) + + if (line->GetCommand() == "ScriptFile" && !resetObject) { - OpString(line, "name", m_scriptFile); + strcpy(m_scriptFile, line->GetParam("name")->AsString().c_str()); continue; } - - if (Cmd(line, "Instructions") && !resetObject) + + if (line->GetCommand() == "Instructions" && !resetObject) { - OpString(line, "name", name); - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); - strcpy(m_infoFilename[SATCOM_HUSTON], path.c_str()); - - m_immediatSatCom = OpInt(line, "immediat", 0); - if (m_version >= 2) m_beginSatCom = m_lockedSatCom = OpInt(line, "lock", 0); + strcpy(m_infoFilename[SATCOM_HUSTON], line->GetParam("name")->AsPath("help/%lng%").c_str()); + + m_immediatSatCom = line->GetParam("immediat")->AsBool(false); + if (m_version >= 2) m_beginSatCom = m_lockedSatCom = line->GetParam("lock")->AsBool(false); if (m_app->GetSceneTestMode()) m_immediatSatCom = false; continue; } - - if (Cmd(line, "Satellite") && !resetObject) + + if (line->GetCommand() == "Satellite" && !resetObject) { - OpString(line, "name", name); - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); - strcpy(m_infoFilename[SATCOM_SAT], path.c_str()); + strcpy(m_infoFilename[SATCOM_SAT], line->GetParam("name")->AsPath("help/%lng%").c_str()); continue; } - - if (Cmd(line, "Loading") && !resetObject) + + if (line->GetCommand() == "Loading" && !resetObject) { - OpString(line, "name", name); - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); - strcpy(m_infoFilename[SATCOM_LOADING], path.c_str()); + strcpy(m_infoFilename[SATCOM_LOADING], line->GetParam("name")->AsPath("help/%lng%").c_str()); continue; } - - if (Cmd(line, "HelpFile") && !resetObject) + + if (line->GetCommand() == "HelpFile" && !resetObject) { - OpString(line, "name", name); - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); - strcpy(m_infoFilename[SATCOM_PROG], path.c_str()); + strcpy(m_infoFilename[SATCOM_PROG], line->GetParam("name")->AsPath("help/%lng%").c_str()); continue; } - if (Cmd(line, "SoluceFile") && !resetObject) + if (line->GetCommand() == "SoluceFile" && !resetObject) { - OpString(line, "name", name); - std::string path = CGameData::GetInstancePointer()->GetFilePath(DIR_HELP, name); - strcpy(m_infoFilename[SATCOM_SOLUCE], path.c_str()); + strcpy(m_infoFilename[SATCOM_SOLUCE], line->GetParam("name")->AsPath("help/%lng%").c_str()); continue; } - - if (Cmd(line, "EndingFile") && !resetObject) + + if (line->GetCommand() == "EndingFile" && !resetObject) { - m_endingWinRank = OpInt(line, "win", 0); - m_endingLostRank = OpInt(line, "lost", 0); + // NOTE: The old default was 0, but I think -1 is more correct - 0 means "ending file 000", while -1 means "no ending file" + m_endingWinRank = line->GetParam("win")->AsInt(-1); + m_endingLostRank = line->GetParam("lost")->AsInt(-1); continue; } - - if (Cmd(line, "MessageDelay") && !resetObject) + + if (line->GetCommand() == "MessageDelay" && !resetObject) { - m_displayText->SetDelay(OpFloat(line, "factor", 1.0f)); + m_displayText->SetDelay(line->GetParam("factor")->AsFloat()); continue; } - - if (Cmd(line, "CacheAudio") && !resetObject && m_version >= 2) + + if (line->GetCommand() == "CacheAudio" && !resetObject && m_version >= 2) { - OpString(line, "filename", name); - m_sound->CacheMusic(name); + m_sound->CacheMusic(line->GetParam("filename")->AsPath("").c_str()); //TODO: don't make this relative to music/ continue; } - - if (Cmd(line, "AudioChange") && !resetObject && m_version >= 2 && m_controller == nullptr) + + if (line->GetCommand() == "AudioChange" && !resetObject && m_version >= 2 && m_controller == nullptr) { int i = m_audioChangeTotal; if (i < 10) { - m_audioChange[i].pos = OpPos(line, "pos")*g_unit; - m_audioChange[i].dist = OpFloat(line, "dist", 1000.0f)*g_unit; - m_audioChange[i].type = OpTypeObject(line, "type", OBJECT_NULL); - m_audioChange[i].min = OpInt(line, "min", 1); - m_audioChange[i].max = OpInt(line, "max", 9999); - m_audioChange[i].powermin = OpFloat(line, "powermin", -1); - m_audioChange[i].powermax = OpFloat(line, "powermax", 100); - m_audioChange[i].tool = OpTool(line, "tool"); - m_audioChange[i].drive = OpDrive(line, "drive"); - OpString(line, "filename", m_audioChange[i].music); - m_audioChange[i].repeat = OpInt(line, "repeat", 1); + m_audioChange[i].pos = line->GetParam("pos")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit; + m_audioChange[i].dist = line->GetParam("dist")->AsFloat(1000.0f)*g_unit; + m_audioChange[i].type = line->GetParam("type")->AsObjectType(OBJECT_NULL); + m_audioChange[i].min = line->GetParam("min")->AsInt(1); + m_audioChange[i].max = line->GetParam("max")->AsInt(9999); + m_audioChange[i].powermin = line->GetParam("powermin")->AsFloat(-1); + m_audioChange[i].powermax = line->GetParam("powermax")->AsFloat(100); + m_audioChange[i].tool = line->GetParam("tool")->AsToolType(TOOL_OTHER); + m_audioChange[i].drive = line->GetParam("drive")->AsDriveType(DRIVE_OTHER); + strcpy(m_audioChange[i].music, line->GetParam("filename")->AsPath("").c_str()); //TODO: don't make this relative to music/ + m_audioChange[i].repeat = line->GetParam("repeat")->AsBool(true); m_audioChange[i].changed = false; m_sound->CacheMusic(m_audioChange[i].music); m_audioChangeTotal ++; } continue; } - - if (Cmd(line, "Audio") && !resetObject && m_controller == nullptr) + + if (line->GetCommand() == "Audio" && !resetObject && m_controller == nullptr) { if (m_version < 2) { - int trackid = OpInt(line, "track", 0); + int trackid = line->GetParam("track")->AsInt(); if (trackid != 0) { std::stringstream filenameStr; filenameStr << "music" << std::setfill('0') << std::setw(3) << trackid << ".ogg"; m_audioTrack = filenameStr.str(); } - m_audioRepeat = OpInt(line, "repeat", 1); + m_audioRepeat = line->GetParam("repeat")->AsBool(true); } else { - char trackname[100]; + m_audioTrack = line->GetParam("main")->AsPath("", ""); //TODO: don't make this relative to music/ + m_audioRepeat = line->GetParam("mainRepeat")->AsBool(true); - OpString(line, "main", trackname); - m_audioTrack = trackname; - m_audioRepeat = OpInt(line, "mainRepeat", 1); + m_satcomTrack = line->GetParam("satcom")->AsPath("", ""); //TODO: don't make this relative to music/ + m_satcomRepeat = line->GetParam("satcomRepeat")->AsBool(true); - OpString(line, "satcom", trackname); - m_satcomTrack = trackname; - m_satcomRepeat = OpInt(line, "satcomRepeat", 1); - - OpString(line, "editor", trackname); - m_editorTrack = trackname; - m_editorRepeat = OpInt(line, "editorRepeat", 1); + m_editorTrack = line->GetParam("editor")->AsPath("", ""); //TODO: don't make this relative to music/ + m_editorRepeat = line->GetParam("editorRepeat")->AsBool(true); } if (m_audioTrack != "") m_sound->CacheMusic(m_audioTrack); if (m_satcomTrack != "") m_sound->CacheMusic(m_satcomTrack); if (m_editorTrack != "") m_sound->CacheMusic(m_editorTrack); continue; } - - if (Cmd(line, "AmbientColor") && !resetObject) + + if (line->GetCommand() == "AmbientColor" && !resetObject) { - m_engine->SetAmbientColor(OpColor(line, "air", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0); - m_engine->SetAmbientColor(OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1); + m_engine->SetAmbientColor(line->GetParam("air")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0); + m_engine->SetAmbientColor(line->GetParam("water")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1); continue; } - - if (Cmd(line, "FogColor") && !resetObject) + + if (line->GetCommand() == "FogColor" && !resetObject) { - m_engine->SetFogColor(OpColor(line, "air", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0); - m_engine->SetFogColor(OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1); + m_engine->SetFogColor(line->GetParam("air")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0); + m_engine->SetFogColor(line->GetParam("water")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1); continue; } - - if (Cmd(line, "VehicleColor") && !resetObject) + + if (line->GetCommand() == "VehicleColor" && !resetObject) { - m_colorNewBot = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); + m_colorNewBot = line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } - - if (Cmd(line, "InsectColor") && !resetObject) + + if (line->GetCommand() == "InsectColor" && !resetObject) { - m_colorNewAlien = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); + m_colorNewAlien = line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } - - if (Cmd(line, "GreeneryColor") && !resetObject) + + if (line->GetCommand() == "GreeneryColor" && !resetObject) { - m_colorNewGreen = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); + m_colorNewGreen = line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)); continue; } - - if (Cmd(line, "DeepView") && !resetObject) + + if (line->GetCommand() == "DeepView" && !resetObject) { - m_engine->SetDeepView(OpFloat(line, "air", 500.0f)*g_unit, 0, true); - m_engine->SetDeepView(OpFloat(line, "water", 100.0f)*g_unit, 1, true); + m_engine->SetDeepView(line->GetParam("air")->AsFloat(500.0f)*g_unit, 0, true); + m_engine->SetDeepView(line->GetParam("water")->AsFloat(100.0f)*g_unit, 1, true); continue; } - - if (Cmd(line, "FogStart") && !resetObject) + + if (line->GetCommand() == "FogStart" && !resetObject) { - m_engine->SetFogStart(OpFloat(line, "air", 0.5f), 0); - m_engine->SetFogStart(OpFloat(line, "water", 0.5f), 1); + m_engine->SetFogStart(line->GetParam("air")->AsFloat(0.5f), 0); + m_engine->SetFogStart(line->GetParam("water")->AsFloat(0.5f), 1); continue; } - - if (Cmd(line, "SecondTexture") && !resetObject) + + if (line->GetCommand() == "SecondTexture" && !resetObject) { - m_engine->SetSecondTexture(OpInt(line, "rank", 1)); + m_engine->SetSecondTexture(line->GetParam("rank")->AsInt()); continue; } - - if (Cmd(line, "Background") && !resetObject) - { - OpString(line, "image", name); - m_engine->SetBackground(name, - OpColor(line, "up", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), - OpColor(line, "down", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), - OpColor(line, "cloudUp", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), - OpColor(line, "cloudDown", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), - OpInt(line, "full", 0)); + + if (line->GetCommand() == "Background" && !resetObject) + { + m_engine->SetBackground(line->GetParam("image")->AsPath("", "").c_str(), //TODO: don't make this relative to textures/ + line->GetParam("up")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), + line->GetParam("down")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), + line->GetParam("cloudUp")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), + line->GetParam("cloudDown")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)), + line->GetParam("full")->AsBool(false)); continue; } - - if (Cmd(line, "Planet") && !resetObject) + + if (line->GetCommand() == "Planet" && !resetObject) { Math::Vector ppos, uv1, uv2; - - ppos = OpPos(line, "pos"); - uv1 = OpPos(line, "uv1"); - uv2 = OpPos(line, "uv2"); - OpString(line, "image", name); - m_planet->Create(OpInt(line, "mode", 0), + + ppos = line->GetParam("pos")->AsPoint(); + uv1 = line->GetParam("uv1")->AsPoint(); + uv2 = line->GetParam("uv2")->AsPoint(); + m_planet->Create(line->GetParam("mode")->AsInt(0), Math::Point(ppos.x, ppos.z), - OpFloat(line, "dim", 0.2f), - OpFloat(line, "speed", 0.0f), - OpFloat(line, "dir", 0.0f), - name, + line->GetParam("dim")->AsFloat(0.2f), + line->GetParam("speed")->AsFloat(0.0f), + line->GetParam("dir")->AsFloat(0.0f), + line->GetParam("image")->AsPath(""), //TODO: don't make this relative to textures/ Math::Point(uv1.x, uv1.z), Math::Point(uv2.x, uv2.z), - strstr(name, "planet") != nullptr // TODO: add transparent op or modify textures - ); + line->GetParam("image")->AsPath("").find("planet") != std::string::npos // TODO: add transparent op or modify textures + ); continue; } - - if (Cmd(line, "ForegroundName") && !resetObject) + + if (line->GetCommand() == "ForegroundName" && !resetObject) { - OpString(line, "image", name); - m_engine->SetForegroundName(name); + m_engine->SetForegroundName(line->GetParam("image")->AsPath("")); //TODO: don't make this relative to textures/ continue; } - - if (((m_version == 1 && Cmd(line, "Global")) || (m_version >= 2 && Cmd(line, "Mission"))) && !resetObject) + + if (((line->GetCommand() == "Global") || (m_version >= 2 && line->GetCommand() == "Mission")) && !resetObject) { - g_unit = OpFloat(line, "unitScale", 4.0f); - m_engine->SetTracePrecision(OpFloat(line, "traceQuality", 1.0f)); - m_shortCut = OpInt(line, "shortcut", 1); + g_unit = line->GetParam("unitScale")->AsFloat(4.0f); + m_engine->SetTracePrecision(line->GetParam("traceQuality")->AsFloat(1.0f)); + m_shortCut = line->GetParam("shortcut")->AsBool(true); if (m_version >= 2) { - m_retroStyle = OpInt(line, "retro", 0); + m_retroStyle = line->GetParam("retro")->AsBool(false); if (m_retroStyle) GetLogger()->Info("Retro mode enabled.\n"); } continue; } - - if (Cmd(line, "TerrainGenerate") && !resetObject) - { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainGenerate after TerrainCreate\n", filename, lineNum); - continue; - } - - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainGenerate after TerrainInit\n", filename, lineNum); - continue; - } - - m_terrain->Generate(OpInt(line, "mosaic", 20), - OpInt(line, "brick", 3), - OpFloat(line, "size", 20.0f), - OpFloat(line, "vision", 500.0f)*g_unit, - OpInt(line, "depth", 2), - OpFloat(line, "hard", 0.5f)); - - m_terrainGenerate = true; + + if (line->GetCommand() == "TerrainGenerate" && !resetObject) + { + m_terrain->Generate(line->GetParam("mosaic")->AsInt(20), + line->GetParam("brick")->AsInt(3), + line->GetParam("size")->AsFloat(20.0f), + line->GetParam("vision")->AsFloat(500.0f)*g_unit, + line->GetParam("depth")->AsInt(2), + line->GetParam("hard")->AsFloat(0.5f)); continue; } - - if (Cmd(line, "TerrainWind") && !resetObject) + + if (line->GetCommand() == "TerrainWind" && !resetObject) { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind after TerrainCreate\n", filename, lineNum); - continue; - } - - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind after TerrainInit\n", filename, lineNum); - continue; - } - - if (!m_terrainGenerate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainWind before TerrainGenerate\n", filename, lineNum); - continue; - } - - m_terrain->SetWind(OpPos(line, "speed")); + m_terrain->SetWind(line->GetParam("speed")->AsPoint()); continue; } - - if (Cmd(line, "TerrainRelief") && !resetObject) + + if (line->GetCommand() == "TerrainRelief" && !resetObject) { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief after TerrainCreate\n", filename, lineNum); - continue; - } - - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief after TerrainInit\n", filename, lineNum); - continue; - } - - if (!m_terrainGenerate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainRelief before TerrainGenerate\n", filename, lineNum); - continue; - } - - OpString(line, "image", name); - m_terrain->LoadRelief(name, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1)); + m_terrain->LoadRelief( + line->GetParam("image")->AsPath("textures"), + line->GetParam("factor")->AsFloat(1.0f), + line->GetParam("border")->AsBool(true)); continue; } - if (Cmd(line, "TerrainRandomRelief") && !resetObject) + if (line->GetCommand() == "TerrainRandomRelief" && !resetObject) { m_terrain->RandomizeRelief(); continue; } - - if (Cmd(line, "TerrainResource") && !resetObject) + + if (line->GetCommand() == "TerrainResource" && !resetObject) { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource after TerrainCreate\n", filename, lineNum); - continue; - } - - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource after TerrainInit\n", filename, lineNum); - continue; - } - - if (!m_terrainGenerate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainResource before TerrainGenerate\n", filename, lineNum); - continue; - } - - OpString(line, "image", name); - m_terrain->LoadResources(name); + m_terrain->LoadResources(line->GetParam("image")->AsPath("textures")); continue; } - - if (Cmd(line, "TerrainWater") && !resetObject) + + if (line->GetCommand() == "TerrainWater" && !resetObject) { - OpString(line, "image", name); Math::Vector pos; - pos.x = OpFloat(line, "moveX", 0.0f); - pos.y = OpFloat(line, "moveY", 0.0f); + pos.x = line->GetParam("moxeX")->AsFloat(0.0f); + pos.y = line->GetParam("moxeY")->AsFloat(0.0f); pos.z = pos.x; - m_water->Create(OpTypeWater(line, "air", Gfx::WATER_TT), - OpTypeWater(line, "water", Gfx::WATER_TT), - name, - OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpColor(line, "ambient", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpFloat(line, "level", 100.0f)*g_unit, - OpFloat(line, "glint", 1.0f), + m_water->Create(line->GetParam("air")->AsWaterType(Gfx::WATER_TT), + line->GetParam("water")->AsWaterType(Gfx::WATER_TT), + line->GetParam("image")->AsPath(""), //TODO: don't make this relative to textures/ + line->GetParam("diffuse")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + line->GetParam("ambient")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + line->GetParam("level")->AsFloat(100.0f)*g_unit, + line->GetParam("glint")->AsFloat(1.0f), pos); - m_colorNewWater = OpColor(line, "color", m_colorRefWater); - m_colorShiftWater = OpFloat(line, "brightness", 0.0f); + m_colorNewWater = line->GetParam("color")->AsColor(m_colorRefWater); + m_colorShiftWater = line->GetParam("brightness")->AsFloat(0.0f); continue; } - - if (Cmd(line, "TerrainLava") && !resetObject) + + if (line->GetCommand() == "TerrainLava" && !resetObject) { - m_water->SetLava(OpInt(line, "mode", 0)); + m_water->SetLava(line->GetParam("mode")->AsBool()); continue; } - - if (Cmd(line, "TerrainCloud") && !resetObject) + + if (line->GetCommand() == "TerrainCloud" && !resetObject) { - OpString(line, "image", name); - m_cloud->Create(name, - OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpColor(line, "ambient", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), - OpFloat(line, "level", 500.0f) * g_unit); + m_cloud->Create(line->GetParam("image")->AsPath("", ""), //TODO: don't make this relative to textures/ + line->GetParam("diffuse")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + line->GetParam("ambient")->AsColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)), + line->GetParam("level")->AsFloat(500.0f)*g_unit); continue; } - - if (Cmd(line, "TerrainBlitz") && !resetObject) + + if (line->GetCommand() == "TerrainBlitz" && !resetObject) { - m_lightning->Create(OpFloat(line, "sleep", 0.0f), - OpFloat(line, "delay", 3.0f), - OpFloat(line, "magnetic", 50.0f) * g_unit); + m_lightning->Create(line->GetParam("sleep")->AsFloat(0.0f), + line->GetParam("delay")->AsFloat(3.0f), + line->GetParam("magnetic")->AsFloat(50.0f)*g_unit); continue; } - - if (Cmd(line, "TerrainInitTextures") && !resetObject) + + if (line->GetCommand() == "TerrainInitTextures" && !resetObject) { - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainInitTextures and TerrainInit at same time\n", filename, lineNum); - continue; + std::string name = line->GetParam("image")->AsPath(""); //TODO: don't make this relative to textures/ + if(name.find(".") == std::string::npos) + name += ".png"; + unsigned int dx = line->GetParam("dx")->AsInt(1); + unsigned int dy = line->GetParam("dy")->AsInt(1); + + int tt[100]; //TODO: I have no idea how TerrainInitTextures works, but maybe we shuld remove the limit to 100? + if(dx*dy > 100) + throw CLevelParserException("In TerrainInitTextures: dx*dy must be <100"); + if(line->GetParam("table")->IsDefined()) { + const std::vector<CLevelParserParam*>& table = line->GetParam("table")->AsArray(); + + if(table.size() > dx*dy) + throw CLevelParserException("In TerrainInitTextures: table size must be dx*dy"); + + for (unsigned int i = 0; i < dx*dy; i++) + { + if(i >= table.size()) + { + tt[i] = 0; + } else { + tt[i] = table[i]->AsInt(); + } + } + } else { + for (unsigned int i = 0; i < dx*dy; i++) + { + tt[i] = 0; + } } - - OpString(line, "image", name); - AddExt(name, ".png"); - int dx = OpInt(line, "dx", 1); - int dy = OpInt(line, "dy", 1); - char* opTable = SearchOp(line, "table"); - int tt[100]; - for (int i = 0; i < dx*dy; i++) - tt[i] = GetInt(opTable, i, 0); - + + /*TODO: ??? if (strstr(name, "%user%") != 0) CopyFileListToTemp(name, tt, dx*dy); - - m_terrain->InitTextures(name, tt, dx, dy); - - m_terrainInitTextures = true; + */ + + m_terrain->InitTextures(name.c_str(), tt, dx, dy); continue; } - - if (Cmd(line, "TerrainInit") && !resetObject) + + if (line->GetCommand() == "TerrainInit" && !resetObject) { - if (m_terrainInitTextures) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainInit and TerrainInitTextures at same time\n", filename, lineNum); - continue; - } - - m_terrain->InitMaterials(OpInt(line, "id", 1)); - m_terrainInit = true; + m_terrain->InitMaterials(line->GetParam("id")->AsInt(1)); continue; } - - if (Cmd(line, "TerrainMaterial") && !resetObject) + + if (line->GetCommand() == "TerrainMaterial" && !resetObject) { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial after TerrainCreate\n", filename, lineNum); - continue; - } - - if (m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial after TerrainInit\n", filename, lineNum); - continue; - } - - if (m_terrainInitTextures) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainMaterial and TerrainInitTextures at same time\n", filename, lineNum); - continue; - } - - OpString(line, "image", name); - AddExt(name, ".png"); + std::string name = line->GetParam("image")->AsPath(""); //TODO: don't make this relative to textures/ + if(name.find(".") == std::string::npos) + name += ".png"; + /*TODO: ??? if (strstr(name, "%user%") != 0) { GetProfile().CopyFileToTemp(std::string(name)); } - - m_terrain->AddMaterial(OpInt(line, "id", 0), - name, - Math::Point(OpFloat(line, "u", 0.0f), - OpFloat(line, "v", 0.0f)), - OpInt(line, "up", 1), - OpInt(line, "right", 1), - OpInt(line, "down", 1), - OpInt(line, "left", 1), - OpFloat(line, "hard", 0.5f)); + */ + + m_terrain->AddMaterial(line->GetParam("id")->AsInt(0), + name.c_str(), + Math::Point(line->GetParam("u")->AsFloat(), + line->GetParam("v")->AsFloat()), + line->GetParam("up")->AsInt(), + line->GetParam("right")->AsInt(), + line->GetParam("down")->AsInt(), + line->GetParam("left")->AsInt(), + line->GetParam("hard")->AsFloat(0.5f)); continue; } - - if (Cmd(line, "TerrainLevel") && !resetObject) + + if (line->GetCommand() == "TerrainLevel" && !resetObject) { - if (m_terrainCreate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel after TerrainCreate\n", filename, lineNum); - continue; - } - - if (!m_terrainInit) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel before TerrainInit\n", filename, lineNum); - continue; - } - - if (m_terrainInitTextures) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel and TerrainInitTextures at same time\n", filename, lineNum); - continue; - } - - if (!m_terrainGenerate) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): TerrainLevel before TerrainGenerate\n", filename, lineNum); - continue; - } - - char* opId = SearchOp(line, "id"); - int id[50]; - int i = 0; - while (i < 50) - { - id[i] = GetInt(opId, i, 0); - if (id[i++] == 0) break; + int id[50]; //TODO: I have no idea how TerrainLevel works, but maybe we should remove the limit to 50? + if(line->GetParam("id")->IsDefined()) { + const std::vector<CLevelParserParam*>& id_array = line->GetParam("id")->AsArray(); + + if(id_array.size() > 50) + throw CLevelParserException("In TerrainLevel: id array size must be < 50"); + + unsigned int i = 0; + while (i < 50) + { + id[i] = id_array[i]->AsInt(); + i++; + if(i >= id_array.size()) break; + } + id[i] = 0; } - + m_terrain->GenerateMaterials(id, - OpFloat(line, "min", 0.0f)*g_unit, - OpFloat(line, "max", 100.0f)*g_unit, - OpFloat(line, "slope", 5.0f), - OpFloat(line, "freq", 100.0f), - OpPos(line, "center")*g_unit, - OpFloat(line, "radius", 0.0f)*g_unit); + line->GetParam("min")->AsFloat(0.0f)*g_unit, + line->GetParam("max")->AsFloat(100.0f)*g_unit, + line->GetParam("slope")->AsFloat(5.0f), + line->GetParam("freq")->AsFloat(100.0f), + line->GetParam("center")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit, + line->GetParam("radius")->AsFloat(0.0f)*g_unit); continue; } - - if (Cmd(line, "TerrainCreate") && !resetObject) + + if (line->GetCommand() == "TerrainCreate" && !resetObject) { m_terrain->CreateObjects(); - m_terrainCreate = true; continue; } - - if (Cmd(line, "BeginObject")) + + if (line->GetCommand() == "BeginObject") { InitEye(); SetMovieLock(false); - + if (read[0] != 0) // loading file ? sel = IOReadScene(read, stack); - - m_beginObject = true; + continue; } - - if (Cmd(line, "MissionController") && read[0] == 0 && m_version >= 2) + + if (line->GetCommand() == "MissionController" && read[0] == 0 && m_version >= 2) { m_controller = CObjectManager::GetInstancePointer()->CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, OBJECT_CONTROLLER, 100.0f); m_controller->SetMagnifyDamage(100.0f); @@ -4578,48 +4229,42 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) CBrain* brain = m_controller->GetBrain(); if (brain != nullptr) { - OpString(line, "script", name); - if (name[0] != 0) - brain->SetScriptName(0, name); + std::string name = line->GetParam("script")->AsPath(""); //TODO: Don't make this relative to ai/ + if (!name.empty()) + brain->SetScriptName(0, const_cast<char*>(name.c_str())); brain->SetScriptRun(0); } continue; } - - if (Cmd(line, "CreateObject") && read[0] == 0) + + if (line->GetCommand() == "CreateObject" && read[0] == 0) { - if (!m_beginObject) - { - GetLogger()->Error("Syntax error in file '%s' (line %d): CreateObject before BeginObject\n", filename, lineNum); - continue; - } - - ObjectType type = OpTypeObject(line, "type", OBJECT_NULL); - - int gadget = OpInt(line, "gadget", -1); + ObjectType type = line->GetParam("type")->AsObjectType(); + + int gadget = line->GetParam("gadget")->AsInt(-1); if ( gadget == -1 ) { gadget = 0; if ( type == OBJECT_TECH || - (type >= OBJECT_PLANT0 && - type <= OBJECT_PLANT19 ) || - (type >= OBJECT_TREE0 && - type <= OBJECT_TREE5 ) || - (type >= OBJECT_TEEN0 && - type <= OBJECT_TEEN44 ) || - (type >= OBJECT_QUARTZ0 && - type <= OBJECT_QUARTZ3 ) || - (type >= OBJECT_ROOT0 && - type <= OBJECT_ROOT4 ) ) // not ROOT5! + (type >= OBJECT_PLANT0 && + type <= OBJECT_PLANT19 ) || + (type >= OBJECT_TREE0 && + type <= OBJECT_TREE5 ) || + (type >= OBJECT_TEEN0 && + type <= OBJECT_TEEN44 ) || + (type >= OBJECT_QUARTZ0 && + type <= OBJECT_QUARTZ3 ) || + (type >= OBJECT_ROOT0 && + type <= OBJECT_ROOT4 ) ) // not ROOT5! { if ( type != OBJECT_TEEN11 && // lamp? - type != OBJECT_TEEN12 && // coke? - type != OBJECT_TEEN20 && // wall? - type != OBJECT_TEEN21 && // wall? - type != OBJECT_TEEN22 && // wall? - type != OBJECT_TEEN26 && // lamp? - type != OBJECT_TEEN28 && // bottle? - type != OBJECT_TEEN34 ) // stone? + type != OBJECT_TEEN12 && // coke? + type != OBJECT_TEEN20 && // wall? + type != OBJECT_TEEN21 && // wall? + type != OBJECT_TEEN22 && // wall? + type != OBJECT_TEEN26 && // lamp? + type != OBJECT_TEEN28 && // bottle? + type != OBJECT_TEEN34 ) // stone? { gadget = 1; } @@ -4629,19 +4274,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) { if (!TestGadgetQuantity(rankGadget++)) continue; } - - Math::Vector pos = OpPos(line, "pos")*g_unit; - float dirAngle = OpFloat(line, "dir", 0.0f)*Math::PI; + + Math::Vector pos = line->GetParam("pos")->AsPoint()*g_unit; + float dirAngle = line->GetParam("dir")->AsFloat(0.0f)*Math::PI; bool trainer; CObject* obj = CObjectManager::GetInstancePointer()->CreateObject( - pos, dirAngle, - type, - OpFloat(line, "power", 1.0f), - OpFloat(line, "z", 1.0f), - OpFloat(line, "h", 0.0f), - trainer = OpInt(line, "trainer", 0), - OpInt(line, "toy", 0), - OpInt(line, "option", 0)); + pos, dirAngle, + type, + line->GetParam("power")->AsFloat(1.0f), + line->GetParam("z")->AsFloat(1.0f), + line->GetParam("h")->AsFloat(0.0f), + trainer = line->GetParam("trainer")->AsBool(false), + line->GetParam("toy")->AsBool(false), + line->GetParam("option")->AsInt(0) + ); if (m_fixScene && type == OBJECT_HUMAN) { @@ -4649,108 +4295,111 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) if (m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f); if (m_phase == PHASE_LOST) motion->SetAction(MHS_LOST, 0.5f); } - + if (obj != nullptr) { obj->SetDefRank(rankObj); - + if (type == OBJECT_BASE) m_base = true; - - Gfx::CameraType cType = OpCamera(line, "camera"); + + Gfx::CameraType cType = line->GetParam("camera")->AsCameraType(Gfx::CAM_TYPE_NULL); if (cType != Gfx::CAM_TYPE_NULL) obj->SetCameraType(cType); - - obj->SetCameraDist(OpFloat(line, "cameraDist", 50.0f)); - obj->SetCameraLock(OpInt(line, "cameraLock", 0)); - - Gfx::PyroType pType = OpPyro(line, "pyro"); + + obj->SetCameraDist(line->GetParam("cameraDist")->AsFloat(50.0f)); + obj->SetCameraLock(line->GetParam("cameraLock")->AsBool(false)); + + Gfx::PyroType pType = line->GetParam("pyro")->AsPyroType(Gfx::PT_NULL); if (pType != Gfx::PT_NULL) { Gfx::CPyro* pyro = new Gfx::CPyro(); pyro->Create(pType, obj); } - + // Puts information in terminal (OBJECT_INFO). for (int i = 0; i < OBJECTMAXINFO; i++) { - sprintf(op, "info%d", i+1); - char text[100]; - OpString(line, op, text); - if (text[0] == 0) break; - char* p = strchr(text, '='); - if (p == 0) break; - *p = 0; + std::string op = "info"+boost::lexical_cast<std::string>(i+1); + if(!line->GetParam(op)->IsDefined()) break; + std::string text = line->GetParam(op)->AsString(); + std::size_t p = text.find_first_of("="); + if(p == std::string::npos) + throw CLevelParserExceptionBadParam(line->GetParam(op), "info"); Info info; - strcpy(info.name, text); - sscanf(p+1, "%f", &info.value); + strcpy(info.name, text.substr(0, p).c_str()); + try { + info.value = boost::lexical_cast<float>(text.substr(p+1).c_str()); + } + catch(...) + { + throw CLevelParserExceptionBadParam(line->GetParam(op), "info.value (float)"); + } obj->SetInfo(i, info); } - + // Sets the parameters of the command line. - char* p = SearchOp(line, "cmdline"); - for (int i = 0; i < OBJECTMAXCMDLINE; i++) - { - float value = GetFloat(p, i, NAN); - if (value == NAN) break; - obj->SetCmdLine(i, value); + if(line->GetParam("cmdline")->IsDefined()) { + const std::vector<CLevelParserParam*>& cmdline = line->GetParam("cmdline")->AsArray(); + for (unsigned int i = 0; i < OBJECTMAXCMDLINE && i < cmdline.size(); i++) //TODO: get rid of the limit + { + obj->SetCmdLine(i, cmdline[i]->AsFloat()); + } } - - if (OpInt(line, "select", 0) == 1) + + if (line->GetParam("select")->AsBool(false)) { sel = obj; } - - bool selectable = OpInt(line, "selectable", 1); + + bool selectable = line->GetParam("selectable")->AsBool(true); obj->SetSelectable(selectable); - obj->SetIgnoreBuildCheck(OpInt(line, "ignoreBuildCheck", 0)); - obj->SetEnable(OpInt(line, "enable", 1)); - obj->SetProxyActivate(OpInt(line, "proxyActivate", 0)); - obj->SetProxyDistance(OpFloat(line, "proxyDistance", 15.0f)*g_unit); - obj->SetRange(OpFloat(line, "range", 30.0f)); - obj->SetShield(OpFloat(line, "shield", 1.0f)); - obj->SetMagnifyDamage(OpFloat(line, "magnifyDamage", 1.0f)); - obj->SetClip(OpInt(line, "clip", 1)); - obj->SetCheckToken(m_version >= 2 ? trainer || !selectable : OpInt(line, "checkToken", 1)); + obj->SetIgnoreBuildCheck(line->GetParam("ignoreBuildCheck")->AsBool(false)); + obj->SetEnable(line->GetParam("enable")->AsBool(true)); + obj->SetProxyActivate(line->GetParam("proxyActivate")->AsBool(false)); + obj->SetProxyDistance(line->GetParam("proxyDistance")->AsFloat(15.0f)*g_unit); + obj->SetRange(line->GetParam("range")->AsFloat(30.0f)); + obj->SetShield(line->GetParam("shield")->AsFloat(1.0f)); + obj->SetMagnifyDamage(line->GetParam("magnifyDamage")->AsFloat(1.0f)); + obj->SetClip(line->GetParam("clip")->AsBool(true)); + obj->SetCheckToken(m_version >= 2 ? trainer || !selectable : line->GetParam("checkToken")->AsBool(true)); // SetManual will affect bot speed if (type == OBJECT_MOBILEdr) { - obj->SetManual(m_version >= 2 ? !trainer : OpInt(line, "manual", 0)); + obj->SetManual(m_version >= 2 ? !trainer : line->GetParam("manual")->AsBool(false)); } - + if (m_version >= 2) { - Math::Vector zoom = OpDir(line, "zoom"); + Math::Vector zoom = line->GetParam("zoom")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f)); if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f) obj->SetZoom(0, zoom); } - + + //TODO: I don't remember what this is used for CMotion* motion = obj->GetMotion(); - if (motion != nullptr) + if (motion != nullptr && line->GetParam("param")->IsDefined()) { - p = SearchOp(line, "param"); - for (int i = 0; i < 10; i++) + const std::vector<CLevelParserParam*>& p = line->GetParam("param")->AsArray(); + for (unsigned int i = 0; i < 10 && i < p.size(); i++) { - float value; - value = GetFloat(p, i, NAN); - if (value == NAN) break; - motion->SetParam(i, value); + motion->SetParam(i, p[i]->AsFloat()); } } - + int run = -1; CBrain* brain = obj->GetBrain(); if (brain != nullptr) { for (int i = 0; i < 10; i++) { - sprintf(op, "script%d", i+1); // script1..script10 - OpString(line, op, name); - if (name[0] != 0) - brain->SetScriptName(i, name); - + std::string op = "script"+boost::lexical_cast<std::string>(i+1); // script1..script10 + if(line->GetParam(op)->IsDefined()) { + brain->SetScriptName(i, const_cast<char*>(line->GetParam(op)->AsPath("").c_str())); //TODO: don't make this relative to ai/ + } + } - - int i = OpInt(line, "run", 0); + + int i = line->GetParam("run")->AsInt(0); if (i != 0) { run = i-1; @@ -4760,17 +4409,16 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) CAuto* automat = obj->GetAuto(); if (automat != nullptr) { - type = OpTypeObject(line, "autoType", OBJECT_NULL); + type = line->GetParam("autoType")->AsObjectType(OBJECT_NULL); automat->SetType(type); for (int i = 0; i < 5; i++) { - sprintf(op, "autoValue%d", i+1); // autoValue1..autoValue5 - automat->SetValue(i, OpFloat(line, op, 0.0f)); + std::string op = "autoValue"+boost::lexical_cast<std::string>(i+1); // autoValue1..autoValue5 + automat->SetValue(i, line->GetParam(op)->AsFloat(0.0f)); } - OpString(line, "autoString", name); - automat->SetString(name); - - int i = OpInt(line, "run", -1); + automat->SetString(const_cast<char*>(line->GetParam("autoString")->AsString("").c_str())); + + int i = line->GetParam("run")->AsInt(-1); if (i != -1) { if (i != PARAM_FIXSCENE && @@ -4778,30 +4426,29 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) automat->Start(i); // starts the film } } - - OpString(line, "soluce", name); - if (soluce && brain != 0 && name[0] != 0) - brain->SetSoluceName(name); - + + if (soluce && brain != nullptr && line->GetParam("soluce")->IsDefined()) + brain->SetSoluceName(const_cast<char*>(line->GetParam("soluce")->AsString().c_str())); + obj->SetResetPosition(obj->GetPosition(0)); obj->SetResetAngle(obj->GetAngle(0)); obj->SetResetRun(run); - - if (OpInt(line, "reset", 0) == 1) + + if (line->GetParam("reset")->AsBool(false)) obj->SetResetCap(RESET_MOVE); } - + rankObj ++; continue; } - - if (Cmd(line, "CreateFog") && !resetObject) + + if (line->GetCommand() == "CreateFog" && !resetObject) { - Gfx::ParticleType type = static_cast<Gfx::ParticleType>((Gfx::PARTIFOG0+OpInt(line, "type", 0))); - Math::Vector pos = OpPos(line, "pos")*g_unit; - float height = OpFloat(line, "height", 1.0f)*g_unit; - float ddim = OpFloat(line, "dim", 50.0f)*g_unit; - float delay = OpFloat(line, "delay", 2.0f); + Gfx::ParticleType type = static_cast<Gfx::ParticleType>(Gfx::PARTIFOG0+(line->GetParam("type")->AsInt())); + Math::Vector pos = line->GetParam("pos")->AsPoint()*g_unit; + float height = line->GetParam("height")->AsFloat(1.0f)*g_unit; + float ddim = line->GetParam("dim")->AsFloat(50.0f)*g_unit; + float delay = line->GetParam("delay")->AsFloat(2.0f); m_terrain->AdjustToFloor(pos); pos.y += height; Math::Point dim; @@ -4810,149 +4457,150 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f); continue; } - - if (Cmd(line, "CreateLight") && !resetObject) + + if (line->GetCommand() == "CreateLight" && !resetObject) { Gfx::EngineObjectType type; - - int lightRank = CreateLight(OpDir(line, "dir"), - OpColor(line, "color", Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f))); - - type = OpTypeTerrain(line, "type", Gfx::ENG_OBJTYPE_NULL); + + int lightRank = CreateLight(line->GetParam("dir")->AsPoint(), + line->GetParam("color")->AsColor(Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f))); + + type = line->GetParam("type")->AsTerrainType(Gfx::ENG_OBJTYPE_NULL); + if (type == Gfx::ENG_OBJTYPE_TERRAIN) { m_lightMan->SetLightPriority(lightRank, Gfx::LIGHT_PRI_HIGHEST); m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_TERRAIN); } - + if (type == Gfx::ENG_OBJTYPE_QUARTZ) m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_QUARTZ); - + if (type == Gfx::ENG_OBJTYPE_METAL) m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_METAL); - + if (type == Gfx::ENG_OBJTYPE_FIX) m_lightMan->SetLightExcludeType(lightRank, Gfx::ENG_OBJTYPE_TERRAIN); - + continue; } - if (Cmd(line, "CreateSpot") && !resetObject) + if (line->GetCommand() == "CreateSpot" && !resetObject) { Gfx::EngineObjectType type; - - int rankLight = CreateSpot(OpDir(line, "pos")*g_unit, - OpColor(line, "color", Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f))); - - type = OpTypeTerrain(line, "type", Gfx::ENG_OBJTYPE_NULL); + + int rankLight = CreateSpot(line->GetParam("pos")->AsPoint()*g_unit, + line->GetParam("color")->AsColor(Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f))); + + type = line->GetParam("type")->AsTerrainType(Gfx::ENG_OBJTYPE_NULL); if (type == Gfx::ENG_OBJTYPE_TERRAIN) m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_TERRAIN); - + if (type == Gfx::ENG_OBJTYPE_QUARTZ) m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_QUARTZ); - + if (type == Gfx::ENG_OBJTYPE_METAL) m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_METAL); - + if (type == Gfx::ENG_OBJTYPE_FIX) m_lightMan->SetLightExcludeType(rankLight, Gfx::ENG_OBJTYPE_TERRAIN); - + continue; } - - if (Cmd(line, "GroundSpot") && !resetObject) + + if (line->GetCommand() == "GroundSpot" && !resetObject) { rank = m_engine->CreateGroundSpot(); if (rank != -1) { - m_engine->SetObjectGroundSpotPos(rank, OpPos(line, "pos")*g_unit); - m_engine->SetObjectGroundSpotRadius(rank, OpFloat(line, "radius", 10.0f)*g_unit); - m_engine->SetObjectGroundSpotColor(rank, OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f))); - m_engine->SetObjectGroundSpotSmooth(rank, OpFloat(line, "smooth", 1.0f)); - m_engine->SetObjectGroundSpotMinMax(rank, OpFloat(line, "min", 0.0f)*g_unit, - OpFloat(line, "max", 0.0f)*g_unit); + m_engine->SetObjectGroundSpotPos(rank, line->GetParam("pos")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit); + m_engine->SetObjectGroundSpotRadius(rank, line->GetParam("radius")->AsFloat(10.0f)*g_unit); + m_engine->SetObjectGroundSpotColor(rank, line->GetParam("color")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f))); + m_engine->SetObjectGroundSpotSmooth(rank, line->GetParam("smooth")->AsFloat(1.0f)); + m_engine->SetObjectGroundSpotMinMax(rank, line->GetParam("min")->AsFloat(0.0f)*g_unit, + line->GetParam("max")->AsFloat(0.0f)*g_unit); } continue; } - - if (Cmd(line, "WaterColor") && !resetObject) + + if (line->GetCommand() == "WaterColor" && !resetObject) { - m_engine->SetWaterAddColor(OpColor(line, "color", Gfx::Color(0.0f, 0.0f, 0.0f, 1.0f))); + m_engine->SetWaterAddColor(line->GetParam("color")->AsColor()); continue; } - - if (Cmd(line, "MapColor") && !resetObject) + + if (line->GetCommand() == "MapColor" && !resetObject) { - m_map->FloorColorMap(OpColor(line, "floor", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), - OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f))); - m_mapShow = OpInt(line, "show", 1); + m_map->FloorColorMap(line->GetParam("floor")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), + line->GetParam("water")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f))); + m_mapShow = line->GetParam("show")->AsBool(true); m_map->ShowMap(m_mapShow); - m_map->SetToy(OpInt(line, "toyIcon", 0)); - m_mapImage = OpInt(line, "image", 0); + m_map->SetToy(line->GetParam("toyIcon")->AsBool(false)); + m_mapImage = line->GetParam("image")->AsBool(false); if (m_mapImage) { - Math::Vector offset; - OpString(line, "filename", m_mapFilename); - offset = OpPos(line, "offset"); - m_map->SetFixParam(OpFloat(line, "zoom", 1.0f), + Math::Vector offset; + strcpy(m_mapFilename, line->GetParam("filename")->AsPath("").c_str()); //TODO: don't make this relative to textures/ + offset = line->GetParam("offset")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f)); + m_map->SetFixParam(line->GetParam("zoom")->AsFloat(1.0f), offset.x, offset.z, - OpFloat(line, "angle", 0.0f)*Math::PI/180.0f, - OpInt(line, "mode", 0), - OpInt(line, "debug", 0)); + line->GetParam("angle")->AsFloat(0.0f)*Math::PI/180.0f, + line->GetParam("mode")->AsInt(0), + line->GetParam("debug")->AsBool(false)); } continue; } - - if (Cmd(line, "MapZoom") && !resetObject) + + if (line->GetCommand() == "MapZoom" && !resetObject) { - m_map->ZoomMap(OpFloat(line, "factor", 2.0f)); - m_map->MapEnable(OpInt(line, "enable", 1)); + m_map->ZoomMap(line->GetParam("factor")->AsFloat(2.0f)); + m_map->MapEnable(line->GetParam("enable")->AsBool(true)); continue; } - - if (Cmd(line, "MaxFlyingHeight") && !resetObject) + + if (line->GetCommand() == "MaxFlyingHeight" && !resetObject) { - m_terrain->SetFlyingMaxHeight(OpFloat(line, "max", 280.0f)*g_unit); + m_terrain->SetFlyingMaxHeight(line->GetParam("max")->AsFloat(280.0f)*g_unit); continue; } - - if (Cmd(line, "AddFlyingHeight") && !resetObject) + + if (line->GetCommand() == "AddFlyingHeight" && !resetObject) { - m_terrain->AddFlyingLimit(OpPos(line, "center")*g_unit, - OpFloat(line, "extRadius", 20.0f)*g_unit, - OpFloat(line, "intRadius", 10.0f)*g_unit, - OpFloat(line, "maxHeight", 200.0f)); + m_terrain->AddFlyingLimit(line->GetParam("center")->AsPoint()*g_unit, + line->GetParam("extRadius")->AsFloat(20.0f)*g_unit, + line->GetParam("intRadius")->AsFloat(10.0f)*g_unit, + line->GetParam("maxHeight")->AsFloat(200.0f)); continue; } - - if (Cmd(line, "Camera")) + + if (line->GetCommand() == "Camera") { - m_camera->Init(OpDir(line, "eye")*g_unit, - OpDir(line, "lookat")*g_unit, - resetObject?0.0f:OpFloat(line, "delay", 0.0f)); - - if (OpInt(line, "fadeIn", 0) == 1) + m_camera->Init(line->GetParam("eye")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit, + line->GetParam("lookat")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit, + resetObject ? 0.0f : line->GetParam("delay")->AsFloat(0.0f)); + + if (line->GetParam("fadeIn")->AsBool(false)) m_camera->StartOver(Gfx::CAM_OVER_EFFECT_FADEIN_WHITE, Math::Vector(0.0f, 0.0f, 0.0f), 1.0f); - - m_camera->SetFixDirection(OpFloat(line, "fixDirection", 0.25f)*Math::PI); + + m_camera->SetFixDirection(line->GetParam("fixDirection")->AsFloat(0.25f)*Math::PI); continue; } - - if (Cmd(line, "EndMissionTake") && !resetObject && m_controller == nullptr) + + if (line->GetCommand() == "EndMissionTake" && !resetObject && m_controller == nullptr) { int i = m_endTakeTotal; if (i < 10) { - m_endTake[i].pos = OpPos(line, "pos")*g_unit; - m_endTake[i].dist = OpFloat(line, "dist", (m_version < 2 ? 8.0f : 100.0f))*g_unit; - m_endTake[i].type = OpTypeObject(line, "type", OBJECT_NULL); - m_endTake[i].min = OpInt(line, "min", 1); - m_endTake[i].max = OpInt(line, "max", 9999); + m_endTake[i].pos = line->GetParam("pos")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit; + m_endTake[i].dist = line->GetParam("dist")->AsFloat(m_version < 2 ? 8.0f : 100.0f)*g_unit; + m_endTake[i].type = line->GetParam("type")->AsObjectType(OBJECT_NULL); + m_endTake[i].min = line->GetParam("min")->AsInt(1); + m_endTake[i].max = line->GetParam("max")->AsInt(9999); if (m_version >= 2) { - m_endTake[i].powermin = OpFloat(line, "powermin", -1); - m_endTake[i].powermax = OpFloat(line, "powermax", 100); - m_endTake[i].tool = OpTool(line, "tool"); - m_endTake[i].drive = OpDrive(line, "drive"); + m_endTake[i].powermin = line->GetParam("powermin")->AsFloat(-1); + m_endTake[i].powermax = line->GetParam("powermax")->AsFloat(100); + m_endTake[i].tool = line->GetParam("tool")->AsToolType(TOOL_OTHER); + m_endTake[i].drive = line->GetParam("drive")->AsDriveType(DRIVE_OTHER); } else { @@ -4961,93 +4609,91 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) m_endTake[i].tool = TOOL_OTHER; m_endTake[i].drive = DRIVE_OTHER; } - m_endTake[i].lost = OpInt(line, "lost", -1); - m_endTake[i].immediat = OpInt(line, "immediat", 0); - OpString(line, "message", m_endTake[i].message); + m_endTake[i].lost = line->GetParam("lost")->AsInt(-1); + m_endTake[i].immediat = line->GetParam("immediat")->AsBool(false); + strcpy(m_endTake[i].message, line->GetParam("message")->AsString("").c_str()); //TODO: Really, ending mission on message()? Is this used anywhere? Do we need that? m_endTakeTotal ++; } continue; } - if (Cmd(line, "EndMissionDelay") && !resetObject && m_controller == nullptr) + if (line->GetCommand() == "EndMissionDelay" && !resetObject && m_controller == nullptr) { - m_endTakeWinDelay = OpFloat(line, "win", 2.0f); - m_endTakeLostDelay = OpFloat(line, "lost", 2.0f); + m_endTakeWinDelay = line->GetParam("win")->AsFloat(2.0f); + m_endTakeLostDelay = line->GetParam("lost")->AsFloat(2.0f); continue; } - if (Cmd(line, "EndMissionResearch") && !resetObject && m_controller == nullptr) + if (line->GetCommand() == "EndMissionResearch" && !resetObject && m_controller == nullptr) //TODO: Is this used anywhere? { - m_endTakeResearch |= OpResearch(line, "type"); + m_endTakeResearch |= line->GetParam("type")->AsResearchFlag(); continue; } - if (Cmd(line, "EndMissionNever") && !resetObject && m_controller == nullptr) + if (line->GetCommand() == "EndMissionNever" && !resetObject && m_controller == nullptr) { m_endTakeNever = true; continue; } - - if (Cmd(line, "ObligatoryToken") && !resetObject) + + if (line->GetCommand() == "ObligatoryToken" && !resetObject) //NOTE: This was used only in CeeBot, maybe we should add this to some Colobot exercises? { int i = m_obligatoryTotal; - if (i < 100) + if (i < 100) //TODO: remove the limit { - OpString(line, "text", m_obligatoryToken[i]); + strcpy(m_obligatoryToken[i], line->GetParam("text")->AsString().c_str()); m_obligatoryTotal ++; } continue; } - - if (Cmd(line, "ProhibitedToken") && !resetObject) + + if (line->GetCommand() == "ProhibitedToken" && !resetObject) //NOTE: This was used only in CeeBot, maybe we should add this to some Colobot exercises? { int i = m_prohibitedTotal; - if (i < 100) + if (i < 100) //TODO: remove the limit { - OpString(line, "text", m_prohibitedToken[i]); + strcpy(m_prohibitedToken[i], line->GetParam("text")->AsString().c_str()); m_prohibitedTotal ++; } continue; } - - if (Cmd(line, "EnableBuild") && !resetObject) + + if (line->GetCommand() == "EnableBuild" && !resetObject) { - g_build |= OpBuild(line, "type"); + g_build |= line->GetParam("type")->AsBuildFlag(); continue; } - - if (Cmd(line, "EnableResearch") && !resetObject) + + if (line->GetCommand() == "EnableResearch" && !resetObject) { - g_researchEnable |= OpResearch(line, "type"); + g_researchEnable |= line->GetParam("type")->AsResearchFlag(); continue; } - - if (Cmd(line, "DoneResearch") && read[0] == 0 && !resetObject) // not loading file? + + if (line->GetCommand() == "DoneResearch" && read[0] == 0 && !resetObject) // not loading file? { - g_researchDone |= OpResearch(line, "type"); + g_researchDone |= line->GetParam("type")->AsResearchFlag(); continue; } - - if (Cmd(line, "NewScript") && !resetObject) + + if (line->GetCommand() == "NewScript" && !resetObject) { - OpString(line, "name", name); - AddNewScriptName(OpTypeObject(line, "type", OBJECT_NULL), name); + char name[200]; + strcpy(name, line->GetParam("name")->AsPath("").c_str()); //TODO: don't make this relative to ai/ + AddNewScriptName(line->GetParam("type")->AsObjectType(OBJECT_NULL), name); continue; } - - if (line[0] == '\n') continue; // Ignore empty lines - if (line[0] == '\0') continue; // Ignore empty lines - if (read[0] != 0) continue; // Ignore when loading saved game - - GetLogger()->Error("Syntax error in file '%s' (line %d): Unknown command: %s", filename, lineNum, line); // Don't add \n at the end of log message - it's included in line variable + + if(read[0] != 0) continue; // ignore errors when loading saevd game (TODO: don't report ones that are just not loaded when loading saved game) + if(resetObject) continue; // ignore when reseting just objects (TODO: see above) + + throw CLevelParserException("Unknown command: '"+line->GetCommand()+"' in "+line->GetLevel()->GetFilename()+":"+boost::lexical_cast<std::string>(line->GetLineNumber())); } - fclose(file); - if (read[0] == 0) CompileScript(soluce); // compiles all scripts - if (strcmp(base, "scene") == 0 && !resetObject) // mission? + if (strcmp(base, "missions") == 0 && !resetObject) // mission? WriteFreeParam(); - if (strcmp(base, "free") == 0 && !resetObject) // free play? + if (strcmp(base, "freemissions") == 0 && !resetObject) // free play? { g_researchDone = m_freeResearch; @@ -5189,7 +4835,7 @@ void CRobotMain::ChangeColor() exclu[3] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom screen exclu[4] = Math::Point(0.0f, 0.0f); exclu[5] = Math::Point(0.0f, 0.0f); // terminator - m_engine->ChangeTextureColor("human.png", colorRef1, colorNew1, colorRef2, colorNew2, 0.30f, 0.01f, ts, ti, exclu); + m_engine->ChangeTextureColor("textures/human.png", colorRef1, colorNew1, colorRef2, colorNew2, 0.30f, 0.01f, ts, ti, exclu); float tolerance; @@ -5231,7 +4877,7 @@ void CRobotMain::ChangeColor() colorNew2.b = 0.0f; char name[100]; - sprintf(name, "face%.2d.png", face+1); + sprintf(name, "textures/face%.2d.png", face+1); exclu[0] = Math::Point(105.0f/256.0f, 47.0f/166.0f); exclu[1] = Math::Point(153.0f/256.0f, 79.0f/166.0f); // blue canister exclu[2] = Math::Point(0.0f, 0.0f); @@ -5245,19 +4891,19 @@ void CRobotMain::ChangeColor() colorNew2.g = 0.0f; colorNew2.b = 0.0f; - m_engine->ChangeTextureColor("base1.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("convert.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("derrick.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("factory.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("lemt.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("roller.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); - m_engine->ChangeTextureColor("search.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/base1.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/convert.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/derrick.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/factory.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/lemt.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/roller.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); + m_engine->ChangeTextureColor("textures/search.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true); exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f); exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils exclu[2] = Math::Point(0.0f, 0.0f); exclu[3] = Math::Point(0.0f, 0.0f); // terminator - m_engine->ChangeTextureColor("drawer.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); + m_engine->ChangeTextureColor("textures/drawer.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f); exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister @@ -5265,26 +4911,26 @@ void CRobotMain::ChangeColor() exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location exclu[4] = Math::Point(0.0f, 0.0f); exclu[5] = Math::Point(0.0f, 0.0f); // terminator - m_engine->ChangeTextureColor("subm.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); + m_engine->ChangeTextureColor("textures/subm.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true); exclu[0] = Math::Point(128.0f/256.0f, 160.0f/256.0f); exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom exclu[2] = Math::Point(0.0f, 0.0f); exclu[3] = Math::Point(0.0f, 0.0f); // terminator - m_engine->ChangeTextureColor("ant.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu); - m_engine->ChangeTextureColor("mother.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti); + m_engine->ChangeTextureColor("textures/ant.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu); + m_engine->ChangeTextureColor("textures/mother.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti); - m_engine->ChangeTextureColor("plant.png", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti); + m_engine->ChangeTextureColor("textures/plant.png", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti); // PARTIPLOUF0 and PARTIDROP : ts = Math::Point(0.500f, 0.500f); ti = Math::Point(0.875f, 0.750f); - m_engine->ChangeTextureColor("effect00.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true); + m_engine->ChangeTextureColor("textures/effect00.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true); // PARTIFLIC : ts = Math::Point(0.00f, 0.75f); ti = Math::Point(0.25f, 1.00f); - m_engine->ChangeTextureColor("effect02.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true); + m_engine->ChangeTextureColor("textures/effect02.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true); } //! Updates the number of unnecessary objects @@ -5718,11 +5364,12 @@ void CRobotMain::CompileScript(bool soluce) { if (brain->GetCompile(j)) continue; - char* name = brain->GetScriptName(j); + std::string name = brain->GetScriptName(j); + name = "ai/"+name; if (name[0] != 0) { - if(! brain->ReadProgram(j, name)) { - CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name); + if(! brain->ReadProgram(j, const_cast<char*>(name.c_str()))) { + CLogger::GetInstancePointer()->Error("Unable to read script from file \"%s\"\n", name.c_str()); } if (!brain->GetCompile(j)) nbError++; } @@ -5794,7 +5441,7 @@ void CRobotMain::LoadOneScript(CObject *obj, int &nbError) char filename[MAX_FNAME]; sprintf(filename, "%s/%s/%c%.3d%.3d%.1d.txt", - GetSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); + GetPHYSFSSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); brain->ReadProgram(i, filename); if (!brain->GetCompile(i)) nbError++; } @@ -5864,7 +5511,7 @@ void CRobotMain::SaveOneScript(CObject *obj) { char filename[MAX_FNAME]; sprintf(filename, "%s/%s/%c%.3d%.3d%.1d.txt", - GetSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); + GetPHYSFSSavegameDir(), m_gamerName.c_str(), name[0], rank, objRank, i); brain->WriteProgram(i, filename); } } @@ -6576,20 +6223,28 @@ void CRobotMain::ResetCreate() m_camera->SetType(Gfx::CAM_TYPE_DIALOG); - CreateScene(m_dialog->GetSceneSoluce(), false, true); + try { + CreateScene(m_dialog->GetSceneSoluce(), false, true); - if (!GetNiceReset()) return; + if (!GetNiceReset()) return; - for (int i = 0; i < 1000000; i++) - { - CObject* obj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i)); - if (obj == nullptr) break; + for (int i = 0; i < 1000000; i++) + { + CObject* obj = static_cast<CObject*>(iMan->SearchInstance(CLASS_OBJECT, i)); + if (obj == nullptr) break; - ResetCap cap = obj->GetResetCap(); - if (cap == RESET_NONE) continue; + ResetCap cap = obj->GetResetCap(); + if (cap == RESET_NONE) continue; - Gfx::CPyro* pyro = new Gfx::CPyro(); - pyro->Create(Gfx::PT_RESET, obj); + Gfx::CPyro* pyro = new Gfx::CPyro(); + pyro->Create(Gfx::PT_RESET, obj); + } + } + catch(const CLevelParserException& e) + { + CLogger::GetInstancePointer()->Error("An error occured while trying to reset scene\n"); + CLogger::GetInstancePointer()->Error("%s\n", e.what()); + ChangePhase(PHASE_TERM); } } @@ -6982,6 +6637,12 @@ bool CRobotMain::GetRadar() return false; } +//TODO: Use PHYSFS everywhere +const char* CRobotMain::GetPHYSFSSavegameDir() +{ + return m_dialog->GetPHYSFSSavegameDir().c_str(); +} + const char* CRobotMain::GetSavegameDir() { return m_dialog->GetSavegameDir().c_str(); @@ -7041,6 +6702,21 @@ float CRobotMain::GetPersoAngle() return m_dialog->GetPersoAngle(); } +char* CRobotMain::GetSceneName() +{ + return m_dialog->GetSceneName(); +} + +int CRobotMain::GetSceneRank() +{ + return m_dialog->GetSceneRank(); +} + +void CRobotMain::BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile) +{ + m_dialog->BuildSceneName(filename, base, rank, sceneFile); +} + //! Changes on the pause mode void CRobotMain::ChangePause(PauseType pause) @@ -7276,3 +6952,8 @@ void CRobotMain::DisplayError(Error err, Math::Vector goal, float height, float { m_displayText->DisplayError(err, goal, height, dist, time); } + +std::string& CRobotMain::GetUserLevelName(int id) +{ + return m_dialog->GetUserLevelName(id); +} diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 71ad455..2c819cc 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file object/robotmain.h @@ -44,7 +47,6 @@ enum Phase PHASE_DEFI, PHASE_MISSION, PHASE_FREE, - PHASE_TEEN, PHASE_USER, PHASE_LOADING, PHASE_SIMUL, @@ -208,6 +210,8 @@ public: void LoadSceneOnStart(const std::string& name, int rank); void CreateIni(); + + void ResetAfterDeviceChanged(); //! Sets the default input bindings (key and axes) void SetDefaultInputBindings(); @@ -327,6 +331,7 @@ public: bool GetSceneSoluce(); bool GetShowAll(); bool GetRadar(); + const char* GetPHYSFSSavegameDir(); const char* GetSavegameDir(); const char* GetPublicDir(); const char* GetFilesDir(); @@ -338,6 +343,9 @@ public: int GetGamerGlasses(); bool GetGamerOnlyHead(); float GetPersoAngle(); + char* GetSceneName(); + int GetSceneRank(); + void BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile = true); void StartMusic(); void StartPauseMusic(PauseType pause); @@ -387,13 +395,14 @@ public: void DisplayError(Error err, CObject* pObj, float time=10.0f); void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f); + + std::string& GetUserLevelName(int id); protected: bool EventFrame(const Event &event); bool EventObject(const Event &event); void InitEye(); - void Convert(); void CreateScene(bool soluce, bool fixScene, bool resetObject); Math::Vector LookatPoint(Math::Vector eye, float angleH, float angleV, float length); @@ -487,13 +496,6 @@ protected: CObject* m_controller; - // Level Checker flags - bool m_beginObject; - bool m_terrainGenerate; - bool m_terrainInitTextures; - bool m_terrainInit; - bool m_terrainCreate; - int m_version; // Mission file version bool m_retroStyle; // Retro bool m_immediatSatCom; // SatCom immediately? diff --git a/src/object/task/task.cpp b/src/object/task/task.cpp index 3624816..1459125 100644 --- a/src/object/task/task.cpp +++ b/src/object/task/task.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/task.h" diff --git a/src/object/task/task.h b/src/object/task/task.h index 800b880..366bcfe 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // task.h diff --git a/src/object/task/taskadvance.cpp b/src/object/task/taskadvance.cpp index 885e100..0b1bf85 100644 --- a/src/object/task/taskadvance.cpp +++ b/src/object/task/taskadvance.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskadvance.h" diff --git a/src/object/task/taskadvance.h b/src/object/task/taskadvance.h index f8c672d..bb966b4 100644 --- a/src/object/task/taskadvance.h +++ b/src/object/task/taskadvance.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskadvance.h diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 4dfd6fb..67661b6 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskbuild.h" diff --git a/src/object/task/taskbuild.h b/src/object/task/taskbuild.h index b3193a0..38b7193 100644 --- a/src/object/task/taskbuild.h +++ b/src/object/task/taskbuild.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskbuild.h diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp index beb4944..010151f 100644 --- a/src/object/task/taskfire.cpp +++ b/src/object/task/taskfire.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskfire.h" diff --git a/src/object/task/taskfire.h b/src/object/task/taskfire.h index 81058df..bf3a775 100644 --- a/src/object/task/taskfire.h +++ b/src/object/task/taskfire.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskfire.h diff --git a/src/object/task/taskfireant.cpp b/src/object/task/taskfireant.cpp index c0acf64..b0ef429 100644 --- a/src/object/task/taskfireant.cpp +++ b/src/object/task/taskfireant.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskfireant.h" diff --git a/src/object/task/taskfireant.h b/src/object/task/taskfireant.h index 2a0ead8..9875480 100644 --- a/src/object/task/taskfireant.h +++ b/src/object/task/taskfireant.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskfireant.h diff --git a/src/object/task/taskflag.cpp b/src/object/task/taskflag.cpp index dd5e11d..598e019 100644 --- a/src/object/task/taskflag.cpp +++ b/src/object/task/taskflag.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskflag.h" diff --git a/src/object/task/taskflag.h b/src/object/task/taskflag.h index 7e3e4ef..a1d61b1 100644 --- a/src/object/task/taskflag.h +++ b/src/object/task/taskflag.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskflag.h #pragma once diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp index 8070d13..46629e0 100644 --- a/src/object/task/taskgoto.cpp +++ b/src/object/task/taskgoto.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include <stdio.h> @@ -34,7 +37,12 @@ const float FLY_DIST_GROUND = 80.0f; // minimum distance to remain on the ground const float FLY_DEF_HEIGHT = 50.0f; // default flying height -const float BM_DIM_STEP = 5.0f; + +// Settings that define goto() accuracy: +const float BM_DIM_STEP = 5.0f; // Size of one pixel on the bitmap. Setting 5 means that 5x5 square (in game units) will be represented by 1 px on the bitmap. Decreasing this value will make a bigger bitmap, and may increase accuracy. TODO: Check how it actually impacts goto() accuracy +const float BEAM_ACCURACY = 5.0f; // higher value = more accurate, but slower +const float SAFETY_MARGIN = 0.5f; // Smallest distance between two objects. Smaller = less "no route to destination", but higher probability of collisions between objects. +// Changing SAFETY_MARGIN (old value was 4.0f) seems to have fixed many issues with goto(). TODO: maybe we could make it even smaller? Did changing it introduce any new bugs? @@ -1736,7 +1744,7 @@ Error CTaskGoto::BeamSearch(const Math::Vector &start, const Math::Vector &goal, m_bmStep ++; len = Math::DistanceProjected(start, goal); - step = len/5.0f; + step = len/BEAM_ACCURACY; if ( step < BM_DIM_STEP*2.1f ) step = BM_DIM_STEP*2.1f; if ( step > 20.0f ) step = 20.0f; nbIter = 200; // in order not to lower the framerate @@ -1966,7 +1974,7 @@ void CTaskGoto::BitmapObject() } if ( type == OBJECT_PARA ) oRadius -= 2.0f; - BitmapSetCircle(oPos, oRadius+iRadius+4.0f); + BitmapSetCircle(oPos, oRadius+iRadius+SAFETY_MARGIN); } } } diff --git a/src/object/task/taskgoto.h b/src/object/task/taskgoto.h index d2b2d7e..383338e 100644 --- a/src/object/task/taskgoto.h +++ b/src/object/task/taskgoto.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskgoto.h diff --git a/src/object/task/taskgungoal.cpp b/src/object/task/taskgungoal.cpp index c9c8d30..f4e4aa6 100644 --- a/src/object/task/taskgungoal.cpp +++ b/src/object/task/taskgungoal.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskgungoal.h" diff --git a/src/object/task/taskgungoal.h b/src/object/task/taskgungoal.h index 9fc509d..59b7d3f 100644 --- a/src/object/task/taskgungoal.h +++ b/src/object/task/taskgungoal.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskgungoal.h diff --git a/src/object/task/taskinfo.cpp b/src/object/task/taskinfo.cpp index 32ac342..50c5e4f 100644 --- a/src/object/task/taskinfo.cpp +++ b/src/object/task/taskinfo.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskinfo.h" diff --git a/src/object/task/taskinfo.h b/src/object/task/taskinfo.h index 1ce3dca..5fdb974 100644 --- a/src/object/task/taskinfo.h +++ b/src/object/task/taskinfo.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskinfo.h diff --git a/src/object/task/taskmanager.cpp b/src/object/task/taskmanager.cpp index 11fba6c..f34b464 100644 --- a/src/object/task/taskmanager.cpp +++ b/src/object/task/taskmanager.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include <stdio.h> diff --git a/src/object/task/taskmanager.h b/src/object/task/taskmanager.h index 80a78fd..908a37a 100644 --- a/src/object/task/taskmanager.h +++ b/src/object/task/taskmanager.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskmanager.h diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp index 0608b6e..f12bde4 100644 --- a/src/object/task/taskmanip.cpp +++ b/src/object/task/taskmanip.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskmanip.h" diff --git a/src/object/task/taskmanip.h b/src/object/task/taskmanip.h index e80602c..ed20b7a 100644 --- a/src/object/task/taskmanip.h +++ b/src/object/task/taskmanip.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskmanip.h diff --git a/src/object/task/taskpen.cpp b/src/object/task/taskpen.cpp index 03c2322..b8d2c70 100644 --- a/src/object/task/taskpen.cpp +++ b/src/object/task/taskpen.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskpen.h" diff --git a/src/object/task/taskpen.h b/src/object/task/taskpen.h index adaba6c..ad2658a 100644 --- a/src/object/task/taskpen.h +++ b/src/object/task/taskpen.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskpen.h diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index d8bbafd..62f675a 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include <stdio.h> diff --git a/src/object/task/taskrecover.h b/src/object/task/taskrecover.h index 817ed5f..685cbd4 100644 --- a/src/object/task/taskrecover.h +++ b/src/object/task/taskrecover.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskrecover.h diff --git a/src/object/task/taskreset.cpp b/src/object/task/taskreset.cpp index 98d9730..75b02b0 100644 --- a/src/object/task/taskreset.cpp +++ b/src/object/task/taskreset.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskreset.h" diff --git a/src/object/task/taskreset.h b/src/object/task/taskreset.h index 5f1bb34..2ba08b5 100644 --- a/src/object/task/taskreset.h +++ b/src/object/task/taskreset.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskreset.h diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp index aa731a0..ce6e4b9 100644 --- a/src/object/task/tasksearch.cpp +++ b/src/object/task/tasksearch.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/tasksearch.h" diff --git a/src/object/task/tasksearch.h b/src/object/task/tasksearch.h index 582d45a..7f6939b 100644 --- a/src/object/task/tasksearch.h +++ b/src/object/task/tasksearch.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // tasksearch.h diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index e9ab157..bd74a4a 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskshield.h" diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h index 36d3819..beb7b56 100644 --- a/src/object/task/taskshield.h +++ b/src/object/task/taskshield.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskshield.h diff --git a/src/object/task/taskspiderexplo.cpp b/src/object/task/taskspiderexplo.cpp index f629714..2dd798f 100644 --- a/src/object/task/taskspiderexplo.cpp +++ b/src/object/task/taskspiderexplo.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskspiderexplo.h" diff --git a/src/object/task/taskspiderexplo.h b/src/object/task/taskspiderexplo.h index 0984020..1b0dba0 100644 --- a/src/object/task/taskspiderexplo.h +++ b/src/object/task/taskspiderexplo.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskspiderexplo.h diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp index c7f0530..14688f3 100644 --- a/src/object/task/tasktake.cpp +++ b/src/object/task/tasktake.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/tasktake.h" diff --git a/src/object/task/tasktake.h b/src/object/task/tasktake.h index 7f3f831..a128e94 100644 --- a/src/object/task/tasktake.h +++ b/src/object/task/tasktake.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // tasktake.h diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 61ff045..58148fa 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include <stdio.h> diff --git a/src/object/task/taskterraform.h b/src/object/task/taskterraform.h index 8ae0d64..952b875 100644 --- a/src/object/task/taskterraform.h +++ b/src/object/task/taskterraform.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskterraform.h diff --git a/src/object/task/taskturn.cpp b/src/object/task/taskturn.cpp index 9c099d2..661fb21 100644 --- a/src/object/task/taskturn.cpp +++ b/src/object/task/taskturn.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskturn.h" diff --git a/src/object/task/taskturn.h b/src/object/task/taskturn.h index 11de476..23cf83c 100644 --- a/src/object/task/taskturn.h +++ b/src/object/task/taskturn.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskturn.h diff --git a/src/object/task/taskwait.cpp b/src/object/task/taskwait.cpp index 5b9fdb3..6ad21f4 100644 --- a/src/object/task/taskwait.cpp +++ b/src/object/task/taskwait.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "object/task/taskwait.h" diff --git a/src/object/task/taskwait.h b/src/object/task/taskwait.h index 3225c9a..4270e27 100644 --- a/src/object/task/taskwait.h +++ b/src/object/task/taskwait.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // taskwait.h diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index a3aaa28..6dd9d32 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "physics/physics.h" diff --git a/src/physics/physics.h b/src/physics/physics.h index fea5601..ace5b58 100644 --- a/src/physics/physics.h +++ b/src/physics/physics.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file physics/physics.h diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp index 81219df..5a23c3e 100644 --- a/src/script/cbottoken.cpp +++ b/src/script/cbottoken.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "script/cbottoken.h" diff --git a/src/script/cbottoken.h b/src/script/cbottoken.h index 976d856..c897726 100644 --- a/src/script/cbottoken.h +++ b/src/script/cbottoken.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file script/cbottoken.h diff --git a/src/script/cmdtoken.cpp b/src/script/cmdtoken.cpp index 6393505..317e881 100644 --- a/src/script/cmdtoken.cpp +++ b/src/script/cmdtoken.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "script/cmdtoken.h" @@ -23,6 +26,8 @@ #include <cstdio> +// TODO: Remove these functions + // Skips spaces. diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h index 8a423c5..de99e41 100644 --- a/src/script/cmdtoken.h +++ b/src/script/cmdtoken.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file script/cmdtoken.h diff --git a/src/script/dd.cpp b/src/script/dd.cpp index a7f5eb9..6c6eab2 100644 --- a/src/script/dd.cpp +++ b/src/script/dd.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // Compilation of a procedure with a "dot". diff --git a/src/script/script.cpp b/src/script/script.cpp index 2299fbf..abb2a8b 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -1,30 +1,35 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "script/script.h" #include "app/app.h" -#include "app/gamedata.h" #include "common/global.h" #include "common/iman.h" #include "common/restext.h" #include "common/stringutils.h" +#include "common/resources/inputstream.h" +#include "common/resources/resourcemanager.h" + #include "graphics/engine/terrain.h" #include "graphics/engine/water.h" #include "graphics/engine/text.h" @@ -4366,7 +4371,6 @@ void CScript::GetError(std::string& error) void CScript::New(Ui::CEdit* edit, const char* name) { - FILE *file = NULL; char res[100]; char text[100]; char script[500]; @@ -4409,18 +4413,18 @@ void CScript::New(Ui::CEdit* edit, const char* name) sf = m_main->GetScriptFile(); if ( sf[0] != 0 ) // Load an empty program specific? { - std::string filename = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, sf); - file = fopen(filename.c_str(), "rb"); - if ( file != NULL ) + std::string filename = sf; + CInputStream stream; + stream.open(filename); + + if (stream.is_open()) { - fseek(file, 0, SEEK_END); - len = ftell(file); - fseek(file, 0, SEEK_SET); + len = stream.size(); if ( len > 500-1 ) len = 500-1; - fread(buffer, 1, len, file); + stream.read(buffer, len); buffer[len] = 0; - fclose(file); + stream.close(); cursor1 = 0; i = 0; @@ -4497,24 +4501,9 @@ bool CScript::SendScript(const char* text) bool CScript::ReadScript(const char* filename) { - FILE* file; Ui::CEdit* edit; - std::string name; - - if ( strchr(filename, '/') == 0 ) //we're reading non user script - { - name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename); - } - else - { - name = filename; - //TODO: is this needed? - // UserDir(name, filename, ""); - } - file = fopen(name.c_str(), "rb"); - if ( file == NULL ) return false; - fclose(file); + if (!CResourceManager::Exists(filename)) return false; delete[] m_script; m_script = nullptr; @@ -4522,7 +4511,7 @@ bool CScript::ReadScript(const char* filename) edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9); edit->SetMaxChar(Ui::EDITSTUDIOMAX); edit->SetAutoIndent(m_engine->GetEditIndentMode()); - edit->ReadText(name.c_str()); + edit->ReadText(filename); GetScript(edit); m_interface->DeleteControl(EVENT_EDIT9); return true; @@ -4533,16 +4522,6 @@ bool CScript::ReadScript(const char* filename) bool CScript::WriteScript(const char* filename) { Ui::CEdit* edit; - std::string name; - - if ( strchr(filename, '/') == 0 ) //we're writing non user script - { - name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename); - } - else - { - name = filename; - } if ( m_script == nullptr ) { @@ -4554,7 +4533,7 @@ bool CScript::WriteScript(const char* filename) edit->SetMaxChar(Ui::EDITSTUDIOMAX); edit->SetAutoIndent(m_engine->GetEditIndentMode()); edit->SetText(m_script); - edit->WriteText(name); + edit->WriteText(filename); m_interface->DeleteControl(EVENT_EDIT9); return true; } diff --git a/src/script/script.h b/src/script/script.h index fb44342..029c875 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file script/script.h diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index 8afbdd2..0d8fe74 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -1,25 +1,25 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "sound/oalsound/alsound.h" -#include "app/gamedata.h" - #include <algorithm> #include <iomanip> @@ -58,20 +58,14 @@ void ALSound::CleanUp() delete channel.second; } - if (m_currentMusic) - { - delete m_currentMusic; - } - + delete m_currentMusic; + for (auto item : m_oldMusic) { delete item.music; } - - if (m_previousMusic.music) - { - delete m_previousMusic.music; - } + + delete m_previousMusic.music; for (auto item : m_sounds) { @@ -165,7 +159,7 @@ int ALSound::GetMusicVolume() bool ALSound::Cache(Sound sound, const std::string &filename) { Buffer *buffer = new Buffer(); - if (buffer->LoadFromFile(CGameData::GetInstancePointer()->GetFilePath(DIR_SOUND, filename), sound)) + if (buffer->LoadFromFile(filename, sound)) { m_sounds[sound] = buffer; return true; @@ -175,12 +169,12 @@ bool ALSound::Cache(Sound sound, const std::string &filename) bool ALSound::CacheMusic(const std::string &filename) { - if (m_music.find(filename) == m_music.end()) + if (m_music.find("music/"+filename) == m_music.end()) { Buffer *buffer = new Buffer(); - if (buffer->LoadFromFile(CGameData::GetInstancePointer()->GetFilePath(DIR_MUSIC, filename), static_cast<Sound>(-1))) + if (buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1))) { - m_music[filename] = buffer; + m_music["music/"+filename] = buffer; return true; } } @@ -301,6 +295,7 @@ bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded) } delete chn; GetLogger()->Debug("Could not open additional channel to play sound!\n"); + break; } } } @@ -635,30 +630,29 @@ bool ALSound::PlayMusic(const std::string &filename, bool bRepeat, float fadeTim return false; } - std::string file = CGameData::GetInstancePointer()->GetFilePath(DIR_MUSIC, filename); Buffer *buffer; // check if we have music in cache - if (m_music.find(filename) == m_music.end()) + if (m_music.find("music/"+filename) == m_music.end()) { GetLogger()->Debug("Music %s was not cached!\n", filename.c_str()); - if (!boost::filesystem::exists(file)) + /* TODO: if (!boost::filesystem::exists("music/"+filename)) { GetLogger()->Debug("Requested music %s was not found.\n", filename.c_str()); return false; - } + } */ buffer = new Buffer(); - if (!buffer->LoadFromFile(file, static_cast<Sound>(-1))) + if (!buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1))) { return false; } - m_music[filename] = buffer; + m_music["music/"+filename] = buffer; } else { GetLogger()->Debug("Music loaded from cache\n"); - buffer = m_music[filename]; + buffer = m_music["music/"+filename]; } if (m_currentMusic) diff --git a/src/sound/oalsound/alsound.h b/src/sound/oalsound/alsound.h index bb9bf28..08caac3 100644 --- a/src/sound/oalsound/alsound.h +++ b/src/sound/oalsound/alsound.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file alsound.h @@ -48,45 +50,44 @@ public: ALSound(); ~ALSound(); - bool Create(); - bool Cache(Sound, const std::string &); - bool CacheMusic(const std::string &); - - bool GetEnable(); - - void SetAudioVolume(int volume); - int GetAudioVolume(); - void SetMusicVolume(int volume); - int GetMusicVolume(); - - void SetListener(const Math::Vector &eye, const Math::Vector &lookat); - void FrameMove(float rTime); - - int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false); - int Play(Sound sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false); - bool FlushEnvelope(int channel); - bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper); - bool Position(int channel, const Math::Vector &pos); - bool Frequency(int channel, float frequency); - bool Stop(int channel); - bool StopAll(); - bool MuteAll(bool bMute); - - bool PlayMusic(int rank, bool bRepeat, float fadeTime=2.0f); - bool PlayMusic(const std::string &filename, bool bRepeat, float fadeTime=2.0f); - bool RestartMusic(); - void SuspendMusic(); - void StopMusic(float fadeTime=2.0f); - bool IsPlayingMusic(); - bool PlayPauseMusic(const std::string &filename, bool repeat); - void StopPauseMusic(); - - bool CheckChannel(int &channel); + bool Create() override; + bool Cache(Sound, const std::string &) override; + bool CacheMusic(const std::string &) override; + + bool GetEnable() override; + + void SetAudioVolume(int volume) override; + int GetAudioVolume() override; + void SetMusicVolume(int volume) override; + int GetMusicVolume() override; + + void SetListener(const Math::Vector &eye, const Math::Vector &lookat) override; + void FrameMove(float rTime) override; + + int Play(Sound sound, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) override; + int Play(Sound sound, const Math::Vector &pos, float amplitude=1.0f, float frequency=1.0f, bool bLoop = false) override; + bool FlushEnvelope(int channel) override; + bool AddEnvelope(int channel, float amplitude, float frequency, float time, SoundNext oper) override; + bool Position(int channel, const Math::Vector &pos) override; + bool Frequency(int channel, float frequency) override; + bool Stop(int channel) override; + bool StopAll() override; + bool MuteAll(bool bMute) override; + + bool PlayMusic(int rank, bool bRepeat, float fadeTime=2.0f) override; + bool PlayMusic(const std::string &filename, bool bRepeat, float fadeTime=2.0f) override; + bool RestartMusic() override; + void SuspendMusic() override; + void StopMusic(float fadeTime=2.0f) override; + bool IsPlayingMusic() override; + bool PlayPauseMusic(const std::string &filename, bool repeat) override; + void StopPauseMusic() override; private: void CleanUp(); int GetPriority(Sound); bool SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded); + bool CheckChannel(int &channel); bool m_enabled; float m_audioVolume; diff --git a/src/sound/oalsound/buffer.cpp b/src/sound/oalsound/buffer.cpp index b27029c..7584767 100644 --- a/src/sound/oalsound/buffer.cpp +++ b/src/sound/oalsound/buffer.cpp @@ -1,23 +1,29 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "sound/oalsound/buffer.h" -#include <cstring> +#include <memory> + +#include "common/resources/resourcemanager.h" + Buffer::Buffer() { @@ -42,19 +48,17 @@ bool Buffer::LoadFromFile(std::string filename, Sound sound) m_sound = sound; GetLogger()->Debug("Loading audio file: %s\n", filename.c_str()); - SF_INFO fileInfo; - memset(&fileInfo, 0, sizeof(SF_INFO)); - SNDFILE *file = sf_open(filename.c_str(), SFM_READ, &fileInfo); + std::unique_ptr<CSNDFile> file = std::unique_ptr<CSNDFile>(CResourceManager::GetSNDFileHandler(filename)); - GetLogger()->Trace(" channels %d\n", fileInfo.channels); - GetLogger()->Trace(" format %d\n", fileInfo.format); - GetLogger()->Trace(" frames %d\n", fileInfo.frames); - GetLogger()->Trace(" samplerate %d\n", fileInfo.samplerate); - GetLogger()->Trace(" sections %d\n", fileInfo.sections); + GetLogger()->Trace(" channels %d\n", file->GetFileInfo().channels); + GetLogger()->Trace(" format %d\n", file->GetFileInfo().format); + GetLogger()->Trace(" frames %d\n", file->GetFileInfo().frames); + GetLogger()->Trace(" samplerate %d\n", file->GetFileInfo().samplerate); + GetLogger()->Trace(" sections %d\n", file->GetFileInfo().sections); - if (!file) + if (!file->IsOpen()) { - GetLogger()->Warn("Could not load file. Reason: %s\n", sf_strerror(file)); + GetLogger()->Warn("Could not load file. Reason: %s\n", file->GetLastError().c_str()); m_loaded = false; return false; } @@ -64,23 +68,21 @@ bool Buffer::LoadFromFile(std::string filename, Sound sound) { GetLogger()->Warn("Could not create audio buffer\n"); m_loaded = false; - sf_close(file); return false; } // read chunks of 4096 samples std::vector<uint16_t> data; std::array<int16_t, 4096> buffer; - data.reserve(fileInfo.frames); + data.reserve(file->GetFileInfo().frames); size_t read = 0; - while ((read = sf_read_short(file, buffer.data(), buffer.size())) != 0) + while ((read = file->Read(buffer.data(), buffer.size())) != 0) { data.insert(data.end(), buffer.begin(), buffer.begin() + read); } - sf_close(file); - alBufferData(m_buffer, fileInfo.channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, &data.front(), data.size() * sizeof(uint16_t), fileInfo.samplerate); - m_duration = static_cast<float>(fileInfo.frames) / fileInfo.samplerate; + alBufferData(m_buffer, file->GetFileInfo().channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, &data.front(), data.size() * sizeof(uint16_t), file->GetFileInfo().samplerate); + m_duration = static_cast<float>(file->GetFileInfo().frames) / file->GetFileInfo().samplerate; m_loaded = true; return true; } diff --git a/src/sound/oalsound/buffer.h b/src/sound/oalsound/buffer.h index e693d75..a34f764 100644 --- a/src/sound/oalsound/buffer.h +++ b/src/sound/oalsound/buffer.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file buffer.h diff --git a/src/sound/oalsound/channel.cpp b/src/sound/oalsound/channel.cpp index 7021c2f..c7311f7 100644 --- a/src/sound/oalsound/channel.cpp +++ b/src/sound/oalsound/channel.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "sound/oalsound/channel.h" diff --git a/src/sound/oalsound/channel.h b/src/sound/oalsound/channel.h index 1d988c9..4e0b52c 100644 --- a/src/sound/oalsound/channel.h +++ b/src/sound/oalsound/channel.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file channel.h diff --git a/src/sound/oalsound/check.h b/src/sound/oalsound/check.h index b8f67c0..ec0a328 100644 --- a/src/sound/oalsound/check.h +++ b/src/sound/oalsound/check.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // check.h diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index 9cae1fd..abc18f6 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012-2013, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "sound/sound.h" @@ -46,7 +48,7 @@ void CSoundInterface::CacheAll() for ( int i = 1; i < SOUND_MAX; i++ ) { std::stringstream filename; - filename << "sound" << std::setfill('0') << std::setw(3) << i << ".wav"; + filename << "sounds/sound" << std::setfill('0') << std::setw(3) << i << ".wav"; if ( !Cache(static_cast<Sound>(i), filename.str()) ) GetLogger()->Warn("Unable to load audio: %s\n", filename.str().c_str()); } diff --git a/src/sound/sound.h b/src/sound/sound.h index 22a5ee2..2ed4199 100644 --- a/src/sound/sound.h +++ b/src/sound/sound.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file sound/sound.h diff --git a/src/tools/convert_model.cpp b/src/tools/convert_model.cpp index 57e8789..44afecd 100644 --- a/src/tools/convert_model.cpp +++ b/src/tools/convert_model.cpp @@ -1,3 +1,21 @@ +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "common/logger.h" #include "graphics/engine/modelfile.h" diff --git a/src/ui/button.cpp b/src/ui/button.cpp index 810d365..0a10379 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/button.h" @@ -176,7 +178,7 @@ void CButton::Draw() (m_state & STATE_CARD ) == 0 && (m_state & STATE_SIMPLY) == 0 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); dp = 0.5f / 256.0f; diff --git a/src/ui/button.h b/src/ui/button.h index b71ef4a..2c66468 100644 --- a/src/ui/button.h +++ b/src/ui/button.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // button.h diff --git a/src/ui/check.cpp b/src/ui/check.cpp index 6a92554..e590309 100644 --- a/src/ui/check.cpp +++ b/src/ui/check.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/check.h" @@ -102,7 +104,7 @@ void CCheck::Draw() DrawShadow(m_pos, m_dim); } - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); zoomExt = 1.00f; diff --git a/src/ui/check.h b/src/ui/check.h index 65bc367..cdb5134 100644 --- a/src/ui/check.h +++ b/src/ui/check.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // check.h diff --git a/src/ui/color.cpp b/src/ui/color.cpp index d1dc746..ddf7629 100644 --- a/src/ui/color.cpp +++ b/src/ui/color.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/color.h" @@ -138,7 +140,7 @@ void CColor::Draw() DrawShadow(m_pos, m_dim); } - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); CControl::Draw(); diff --git a/src/ui/color.h b/src/ui/color.h index fe96b87..06b259e 100644 --- a/src/ui/color.h +++ b/src/ui/color.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // color.h diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp index d0fe96f..45977c5 100644 --- a/src/ui/compass.cpp +++ b/src/ui/compass.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/compass.h" @@ -88,7 +90,7 @@ void CCompass::Draw() device = m_engine->GetDevice(); - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); p1.x = m_pos.x; diff --git a/src/ui/compass.h b/src/ui/compass.h index 956631a..510d9e8 100644 --- a/src/ui/compass.h +++ b/src/ui/compass.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // compass.h diff --git a/src/ui/control.cpp b/src/ui/control.cpp index 4e64ee9..a4cdbfc 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/control.h" @@ -437,7 +439,7 @@ void CControl::Draw() if ( (m_state & STATE_VISIBLE) == 0 ) return; - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); zoomExt = 1.00f; @@ -491,7 +493,7 @@ void CControl::Draw() if ( m_state & STATE_OKAY ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); icon = 3; // yellow with green point pressed } @@ -506,19 +508,19 @@ void CControl::Draw() if ( icon >= 192 ) { icon -= 192; - m_engine->SetTexture("text.png"); + m_engine->SetTexture("textures/interface/text.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); } else if ( icon >= 128 ) { icon -= 128; - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); } else if ( icon >= 64 ) { icon -= 64; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); } else @@ -751,7 +753,7 @@ void CControl::DrawWarning(Math::Point pos, Math::Point dim) dp = 0.5f / 256.0f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; @@ -795,7 +797,7 @@ void CControl::DrawShadow(Math::Point pos, Math::Point dim, float deep) dp = 0.5f/256.0f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState( Gfx::ENG_RSTATE_TTEXTURE_WHITE); pos.x += deep * 0.010f * 0.75f; diff --git a/src/ui/control.h b/src/ui/control.h index 1ca07cf..5306641 100644 --- a/src/ui/control.h +++ b/src/ui/control.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code; -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // control.h diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index e7748ae..aceb5b0 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/displayinfo.h" @@ -156,28 +158,28 @@ bool CDisplayInfo::EventProcess(const Event &event) { m_main->SetFontSize(9.0f); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); - if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f); + if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); ViewDisplayInfo(); } if ( event.type == EVENT_HYPER_SIZE2 ) // size 2? { - m_main->SetFontSize(10.0f); + m_main->SetFontSize(14.0f); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); - if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f); + if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); ViewDisplayInfo(); } if ( event.type == EVENT_HYPER_SIZE3 ) // size 3? { - m_main->SetFontSize(12.0f); + m_main->SetFontSize(19.0f); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); - if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f); + if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); ViewDisplayInfo(); } if ( event.type == EVENT_HYPER_SIZE4 ) // size 4? { - m_main->SetFontSize(15.0f); + m_main->SetFontSize(24.0f); slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); - if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/12.0f); + if ( slider != 0 ) slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); ViewDisplayInfo(); } @@ -185,7 +187,7 @@ bool CDisplayInfo::EventProcess(const Event &event) { slider = static_cast<Ui::CSlider*>(pw->SearchControl(EVENT_STUDIO_SIZE)); if ( slider == 0 ) return false; - m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f); + m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f); ViewDisplayInfo(); } @@ -342,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? { @@ -420,7 +420,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc button->SetState(STATE_SHADOW); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider->SetState(STATE_SHADOW); - slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f); + slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY); button->SetState(STATE_SHADOW); HyperUpdate(); @@ -935,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); -} - - } - diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h index 891551b..f820cd6 100644 --- a/src/ui/displayinfo.h +++ b/src/ui/displayinfo.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // displayinfo.h @@ -66,7 +68,6 @@ protected: void UpdateCopyButton(); void ViewDisplayInfo(); CObject* SearchToto(); - void CreateObjectsFile(); protected: Gfx::CEngine* m_engine; diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index 5b3144d..8e944de 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/displaytext.h" diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h index 94572a8..3815407 100644 --- a/src/ui/displaytext.h +++ b/src/ui/displaytext.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // displaytext.h diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index e2df62b..b6e6bbf 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1,29 +1,38 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/edit.h" #include "app/app.h" -#include "app/gamedata.h" #include "clipboard/clipboard.h" +#include "object/robotmain.h" + +#include "object/level/parserparam.h" + +#include "common/resources/inputstream.h" +#include "common/resources/outputstream.h" + #include <string.h> +#include <boost/algorithm/string.hpp> namespace Ui { @@ -115,21 +124,16 @@ CEdit::CEdit () : CControl () CEdit::~CEdit() { - int i; - FreeImage(); - for ( i=0 ; i<EDITUNDOMAX ; i++ ) + for (int i = 0; i < EDITUNDOMAX; i++) { delete m_undo[i].text; m_undo[i].text = nullptr; } - if (m_text != nullptr) - { - delete[] m_text; - m_text = nullptr; - } + delete[] m_text; + m_text = nullptr; delete m_scroll; m_scroll = nullptr; @@ -373,23 +377,23 @@ bool CEdit::EventProcess(const Event &event) MoveChar(1, bControl, bShift); return true; } - if ( event.key.key == KEY(UP) ) + if ( event.key.key == KEY(UP) && m_bMulti ) { MoveLine(-1, bControl, bShift); return true; } - if ( event.key.key == KEY(DOWN) ) + if ( event.key.key == KEY(DOWN) && m_bMulti ) { MoveLine(1, bControl, bShift); return true; } - if ( event.key.key == KEY(PAGEUP) ) // PageUp ? + if ( event.key.key == KEY(PAGEUP) && m_bMulti ) // PageUp ? { MoveLine(-(m_lineVisible-1), bControl, bShift); return true; } - if ( event.key.key == KEY(PAGEDOWN) ) // PageDown ? + if ( event.key.key == KEY(PAGEDOWN) && m_bMulti ) // PageDown ? { MoveLine(m_lineVisible-1, bControl, bShift); return true; @@ -782,16 +786,9 @@ void CEdit::HyperJump(std::string name, std::string marker) sMarker = marker; -//? sprintf(filename, "help\\%s.txt", name); - - if ( name[0] == '%' ) - { - filename = GetProfile().GetUserBasedPath(name, "") + ".txt"; - } - else - { - filename = std::string("help/") + CApplication::GetInstancePointer()->GetLanguageChar() + "/" + name + std::string(".txt"); - } + filename = name + std::string(".txt"); + filename = CLevelParserParam::InjectLevelDir(filename, "help/%lng%"); + boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files if ( ReadText(filename) ) { @@ -1145,7 +1142,9 @@ void CEdit::DrawImage(Math::Point pos, std::string name, float width, float dp; std::string filename; - filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png"; + filename = name + ".png"; + filename = CLevelParserParam::InjectLevelDir(filename, "icons"); + boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files m_engine->SetTexture(filename); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); @@ -1175,7 +1174,7 @@ void CEdit::DrawBack(Math::Point pos, Math::Point dim) if ( m_bGeneric ) return; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); if ( m_bMulti ) @@ -1225,7 +1224,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon) Math::Point uv1, uv2; float dp; - m_engine->SetTexture("text.png"); + m_engine->SetTexture("textures/interface/text.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = (16.0f/256.0f)*(icon%16); @@ -1423,7 +1422,7 @@ void CEdit::FreeImage() for (int i = 0 ; i < m_imageTotal; i++ ) { - filename = GetProfile().GetUserBasedPath(m_image[i].name, "../icons") + ".png"; + filename = m_image[i].name + ".png"; m_engine->DeleteTexture(filename); } } @@ -1433,7 +1432,9 @@ void CEdit::FreeImage() void CEdit::LoadImage(std::string name) { std::string filename; - filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png"; + filename = name + ".png"; + filename = CLevelParserParam::InjectLevelDir(filename, "icons"); + boost::replace_all(filename, "\\", "/"); //TODO: Fix this in files m_engine->LoadTexture(filename); } @@ -1441,7 +1442,6 @@ void CEdit::LoadImage(std::string name) bool CEdit::ReadText(std::string filename, int addSize) { - FILE *file = NULL; char *buffer; int len, i, j, n, font, iIndex, iLines, iCount, iLink, res; char iName[50]; @@ -1450,27 +1450,18 @@ bool CEdit::ReadText(std::string filename, int addSize) InputSlot slot; bool bInSoluce, bBOL; - if ( filename[0] == 0 ) return false; - - boost::replace_all(filename, "\\", "/"); - - /* This is ugly but doesn't require many changes in code. If file doesn't - exists it's posible filename is absolute not full path */ - std::string path = filename; - if (!fs::exists(path)) + if ( filename == "" ) return false; + + CInputStream stream; + stream.open(filename); + + if (!stream.is_open()) { - path = CGameData::GetInstancePointer()->GetDataPath(filename); - } - - file = fopen(fs::path(path).make_preferred().string().c_str(), "rb"); - if ( file == NULL ) { - CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str()); + CLogger::GetInstancePointer()->Error("Failed to load text file %s\n", filename.c_str()); return false; } - fseek(file, 0, SEEK_END); - len = ftell(file); - fseek(file, 0, SEEK_SET); + len = stream.size(); m_maxChar = len+addSize+100; m_len = len; @@ -1479,8 +1470,7 @@ bool CEdit::ReadText(std::string filename, int addSize) FreeImage(); - if (m_text != nullptr) - delete[] m_text; + delete[] m_text; m_text = new char[m_maxChar+1]; memset(m_text, 0, m_maxChar+1); @@ -1488,7 +1478,7 @@ bool CEdit::ReadText(std::string filename, int addSize) buffer = new char[m_maxChar+1]; memset(buffer, 0, m_maxChar+1); - fread(buffer, 1, len, file); + stream.read(buffer, len); m_format.clear(); m_format.reserve(m_maxChar+1); @@ -1497,7 +1487,7 @@ bool CEdit::ReadText(std::string filename, int addSize) m_format.push_back(0); } - fclose(file); + stream.close(); bInSoluce = false; font = m_fontType; @@ -1891,14 +1881,19 @@ bool CEdit::ReadText(std::string filename, int addSize) bool CEdit::WriteText(std::string filename) { - FILE* file; char buffer[1000+20]; int i, j, k, n; float iDim = 0.0f; if ( filename[0] == 0 ) return false; - file = fopen(filename.c_str(), "wb"); - if ( file == NULL ) return false; + + COutputStream stream; + stream.open(filename); + + if (!stream.is_open()) + { + return false; + } if ( m_bAutoIndent ) { @@ -1929,7 +1924,7 @@ bool CEdit::WriteText(std::string filename) if ( j >= 1000-1 ) { - fwrite(buffer, 1, j, file); + stream.write(buffer, j); j = 0; } @@ -1937,10 +1932,10 @@ bool CEdit::WriteText(std::string filename) } if ( j > 0 ) { - fwrite(buffer, 1, j, file); + stream.write(buffer, j); } - fclose(file); + stream.close(); if ( m_bAutoIndent ) { @@ -1958,8 +1953,7 @@ void CEdit::SetMaxChar(int max) { FreeImage(); - if (m_text != nullptr) - delete[] m_text; + delete[] m_text; m_maxChar = max; diff --git a/src/ui/edit.h b/src/ui/edit.h index 9484fc8..cbad394 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** diff --git a/src/ui/editvalue.cpp b/src/ui/editvalue.cpp index 3fb9b79..676f2a6 100644 --- a/src/ui/editvalue.cpp +++ b/src/ui/editvalue.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/editvalue.h" diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h index 2734847..3011d55 100644 --- a/src/ui/editvalue.h +++ b/src/ui/editvalue.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // editvalue.h diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp index a8ee41c..92f4d7c 100644 --- a/src/ui/gauge.cpp +++ b/src/ui/gauge.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/gauge.h" @@ -75,7 +77,7 @@ void CGauge::Draw() if ( (m_state & STATE_VISIBLE) == 0 ) return; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); dp = 0.5f/256.0f; diff --git a/src/ui/gauge.h b/src/ui/gauge.h index 3dbeef8..798171f 100644 --- a/src/ui/gauge.h +++ b/src/ui/gauge.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // gauge.h diff --git a/src/ui/group.cpp b/src/ui/group.cpp index 64495e0..e924ea6 100644 --- a/src/ui/group.cpp +++ b/src/ui/group.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/group.h" @@ -87,7 +90,7 @@ void CGroup::Draw() if ( m_icon == 0 ) // hollow frame? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 160.0f / 256.0f; uv1.y = 192.0f / 256.0f; // u-v texture @@ -103,7 +106,7 @@ void CGroup::Draw() } if ( m_icon == 1 ) // orange solid opaque? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 104.0f / 256.0f; uv1.y = 48.0f / 256.0f; @@ -117,7 +120,7 @@ void CGroup::Draw() } if ( m_icon == 2 ) // orange degrade -> transparent? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 112.0f / 256.0f; uv1.y = 48.0f / 256.0f; @@ -131,7 +134,7 @@ void CGroup::Draw() } if ( m_icon == 3 ) // transparent gradient -> gray? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 120.0f / 256.0f; uv1.y = 48.0f / 256.0f; @@ -145,7 +148,7 @@ void CGroup::Draw() } if ( m_icon == 4 ) // degrade blue corner? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 192.0f / 256.0f; uv1.y = 128.0f / 256.0f; @@ -159,7 +162,7 @@ void CGroup::Draw() } if ( m_icon == 5 ) // degrade orange corner? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 224.0f / 256.0f; uv1.y = 128.0f / 256.0f; @@ -173,7 +176,7 @@ void CGroup::Draw() } if ( m_icon == 6 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 0.0f / 256.0f; // brown transparent uv1.y = 75.0f / 256.0f; @@ -189,7 +192,7 @@ void CGroup::Draw() } if ( m_icon == 7 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; uv1.y = 0.0f / 256.0f; @@ -203,7 +206,7 @@ void CGroup::Draw() } if ( m_icon == 8 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f / 256.0f; // green transparent uv1.y = 160.0f / 256.0f; @@ -217,7 +220,7 @@ void CGroup::Draw() } if ( m_icon == 9 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f / 256.0f; // red transparent uv1.y = 176.0f/256.0f; @@ -231,7 +234,7 @@ void CGroup::Draw() } if ( m_icon == 10 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f / 256.0f; // blue transparent uv1.y = 192.0f / 256.0f; @@ -245,7 +248,7 @@ void CGroup::Draw() } if ( m_icon == 11 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f / 256.0f; // yellow transparent uv1.y = 224.0f / 256.0f; @@ -262,7 +265,7 @@ void CGroup::Draw() dim.x = m_dim.x / 2.0f; dim.y = m_dim.y / 2.0f; - m_engine->SetTexture("mouse.png"); + m_engine->SetTexture("textures/interface/mouse.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); pos.x = m_pos.x-m_dim.x/300.0f; pos.y = m_pos.y+m_dim.y/300.0f+dim.y; @@ -301,7 +304,7 @@ void CGroup::Draw() } if ( m_icon == 13 ) // corner upper / left? { - m_engine->SetTexture("mouse.png"); + m_engine->SetTexture("textures/interface/mouse.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); pos.x = m_pos.x-m_dim.x/150.0f; pos.y = m_pos.y+m_dim.y/150.0f; @@ -322,7 +325,7 @@ void CGroup::Draw() } if ( m_icon == 14 ) // corner upper / right? { - m_engine->SetTexture("mouse.png"); + m_engine->SetTexture("textures/interface/mouse.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); pos.x = m_pos.x-m_dim.x/150.0f; pos.y = m_pos.y+m_dim.y/150.0f; @@ -343,7 +346,7 @@ void CGroup::Draw() } if ( m_icon == 15 ) // corner lower / left? { - m_engine->SetTexture("mouse.png"); + m_engine->SetTexture("textures/interface/mouse.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); pos.x = m_pos.x-m_dim.x/150.0f; pos.y = m_pos.y+m_dim.y/150.0f; @@ -364,7 +367,7 @@ void CGroup::Draw() } if ( m_icon == 16 ) // corner lower / left? { - m_engine->SetTexture("mouse.png"); + m_engine->SetTexture("textures/interface/mouse.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); pos.x = m_pos.x-m_dim.x/150.0f; pos.y = m_pos.y+m_dim.y/150.0f; @@ -385,7 +388,7 @@ void CGroup::Draw() } if ( m_icon == 17 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.0f / 256.0f; // blue frame uv1.y = 75.0f / 256.0f; @@ -401,7 +404,7 @@ void CGroup::Draw() } if ( m_icon == 18 ) // arrow> for SatCom? { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 0.0f / 256.0f; // > uv1.y = 192.0f / 256.0f; @@ -415,7 +418,7 @@ void CGroup::Draw() } if ( m_icon == 19 ) // SatCom symbol? { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 224.0f / 256.0f; // SatCom symbol uv1.y = 224.0f / 256.0f; @@ -429,7 +432,7 @@ void CGroup::Draw() } if ( m_icon == 20 ) // solid blue background? { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 224.0f / 256.0f; uv1.y = 32.0f / 256.0f; @@ -443,7 +446,7 @@ void CGroup::Draw() } if ( m_icon == 21 ) // stand-by symbol? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 160.0f / 256.0f; uv1.y = 32.0f / 256.0f; @@ -457,7 +460,7 @@ void CGroup::Draw() } if ( m_icon == 22 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; // opaque yellow uv1.y = 224.0f / 256.0f; @@ -474,7 +477,7 @@ void CGroup::Draw() if ( m_icon == 23 ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; // yellow uv1.y = 192.0f / 256.0f; @@ -490,7 +493,7 @@ void CGroup::Draw() } if ( m_icon == 24 ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 80.0f / 256.0f; // orange uv1.y = 192.0f / 256.0f; @@ -506,7 +509,7 @@ void CGroup::Draw() } if ( m_icon == 25 ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; // orange uv1.y = 208.0f / 256.0f; @@ -522,7 +525,7 @@ void CGroup::Draw() } if ( m_icon == 26 ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 80.0f / 256.0f; // red uv1.y = 208.0f / 256.0f; @@ -538,7 +541,7 @@ void CGroup::Draw() } if ( m_icon == 27 ) { - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 32.0f / 256.0f; uv1.y = 0.0f / 256.0f; @@ -556,7 +559,7 @@ void CGroup::Draw() pos = m_pos; dim = m_dim; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 32.0f / 256.0f; uv1.y = 32.0f / 256.0f; @@ -568,7 +571,7 @@ void CGroup::Draw() uv2.y -= dp; DrawIcon(pos, dim, uv1, uv2); - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); pos.x += 8.0f / 640.0f; pos.y += 8.0f / 480.0f; diff --git a/src/ui/group.h b/src/ui/group.h index 89996cc..e12bf78 100644 --- a/src/ui/group.h +++ b/src/ui/group.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // group.h diff --git a/src/ui/image.cpp b/src/ui/image.cpp index 8f9b5ca..89e1fd2 100644 --- a/src/ui/image.cpp +++ b/src/ui/image.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/image.h" @@ -110,7 +112,7 @@ void CImage::Draw() if ( m_icon == 0 ) // hollow frame? { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 160.0f / 256.0f; uv1.y = 192.0f / 256.0f; // u-v texture @@ -127,8 +129,10 @@ void CImage::Draw() if ( m_filename[0] != 0 ) // displays an image? { - m_engine->LoadTexture(m_filename); - m_engine->SetTexture(m_filename); + std::string texFilename = m_filename; + texFilename = "textures/"+texFilename; + m_engine->LoadTexture(texFilename.c_str()); + m_engine->SetTexture(texFilename); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); pos = m_pos; dim = m_dim; diff --git a/src/ui/image.h b/src/ui/image.h index fd71e33..cff43a8 100644 --- a/src/ui/image.h +++ b/src/ui/image.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // image.h diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index ab2c01b..bd25bee 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/interface.h" @@ -49,11 +51,8 @@ void CInterface::Flush() { for (int i = 0; i < MAXCONTROL; i++) { - if (m_table[i] != nullptr) - { - delete m_table[i]; - m_table[i] = nullptr; - } + delete m_table[i]; + m_table[i] = nullptr; } } diff --git a/src/ui/interface.h b/src/ui/interface.h index d5734f0..f3e81bb 100644 --- a/src/ui/interface.h +++ b/src/ui/interface.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // interface.h diff --git a/src/ui/key.cpp b/src/ui/key.cpp index aacc8d8..fd9a77f 100644 --- a/src/ui/key.cpp +++ b/src/ui/key.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/key.h" @@ -136,7 +138,7 @@ void CKey::Draw() DrawShadow(m_pos, m_dim); - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); // was D3DSTATENORMAL float zoomExt = 1.00f; diff --git a/src/ui/key.h b/src/ui/key.h index d8e935c..0cc8a4c 100644 --- a/src/ui/key.h +++ b/src/ui/key.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ /** * \file ui/key.h diff --git a/src/ui/label.cpp b/src/ui/label.cpp index 76a95f2..f4d0119 100644 --- a/src/ui/label.cpp +++ b/src/ui/label.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/label.h" diff --git a/src/ui/label.h b/src/ui/label.h index 305aca2..36b6da1 100644 --- a/src/ui/label.h +++ b/src/ui/label.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // label.h diff --git a/src/ui/list.cpp b/src/ui/list.cpp index f6c3ed9..9611533 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/list.h" @@ -61,12 +63,10 @@ CList::~CList() { for (int i = 0; i < LISTMAXDISPLAY; i++) { - if (m_button[i] != nullptr) - delete m_button[i]; + delete m_button[i]; } - if (m_scroll != nullptr) - delete m_scroll; + delete m_scroll; } @@ -388,7 +388,7 @@ void CList::Draw() if (m_icon == 0) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f / 256.0f; @@ -398,7 +398,7 @@ void CList::Draw() } else { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 132.0f / 256.0f; @@ -434,7 +434,7 @@ void CList::Draw() dim.y *= 0.4f; pos.y -= dim.y; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw uv1.x = 120.0f / 256.0f; uv1.y = 64.0f / 256.0f; @@ -509,7 +509,7 @@ void CList::Draw() if ( m_check[i + m_firstLine] ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f / 256.0f; uv1.y = 0.0f / 256.0f; @@ -534,7 +534,7 @@ void CList::Draw() } else { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); // was D3DSTATETTw if ( i + m_firstLine == m_selectLine ) { diff --git a/src/ui/list.h b/src/ui/list.h index a2e033f..4632f76 100644 --- a/src/ui/list.h +++ b/src/ui/list.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // list.h diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f63d22e..fe40609 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1,24 +1,26 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/maindialog.h" #include "app/app.h" -#include "app/gamedata.h" #include "app/system.h" #include "common/config.h" @@ -30,6 +32,12 @@ #include "common/restext.h" #include "common/stringutils.h" +#include "common/resources/resourcemanager.h" +#include "common/resources/inputstream.h" +#include "common/resources/outputstream.h" + +#include "object/level/parser.h" + #include "object/robotmain.h" #include "script/cmdtoken.h" @@ -174,18 +182,9 @@ CMainDialog::CMainDialog() m_partiTime[i] = 0.0f; } - - m_sceneDir = "levels"; - - #if DEV_BUILD m_savegameDir = "savegame"; - #else - m_savegameDir = GetSystemUtils()->GetSavegameDirectoryLocation(); - #endif - - m_publicDir = "program"; - m_userDir = "user"; - m_filesDir = m_savegameDir; + m_publicDir = CResourceManager::GetSaveLocation()+"/program"; //TODO: Refactor to use PHYSFS + m_filesDir = CResourceManager::GetSaveLocation()+"/files"; //TODO: Refactor to use PHYSFS m_setupFull = m_app->GetVideoConfig().fullScreen; @@ -316,7 +315,6 @@ void CMainDialog::ChangePhase(Phase phase) pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT); pb->SetState(STATE_SHADOW); - #if DEV_BUILD if ( m_accessEnable && m_accessUser ) { pos.x = 447.0f/640.0f; @@ -325,7 +323,6 @@ void CMainDialog::ChangePhase(Phase phase) pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER); pb->SetState(STATE_SHADOW); } - #endif /*pos.x = 139.0f/640.0f; pos.y = 313.0f/480.0f; @@ -340,11 +337,11 @@ void CMainDialog::ChangePhase(Phase phase) pg = pw->CreateGroup(pos, ddim, 1, EVENT_LABEL1); pg->SetState(STATE_SHADOW); pos.y -= 5.0f/480.0f; - pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "PPC Team"); + pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "TerranovaTeam"); pl->SetFontType(Gfx::FONT_COURIER); pl->SetFontSize(Gfx::FONT_SIZE_SMALL); - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -451,7 +448,7 @@ void CMainDialog::ChangePhase(Phase phase) UpdateNameControl(); UpdateNameFace(); - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -704,7 +701,6 @@ void CMainDialog::ChangePhase(Phase phase) m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { if ( m_phase == PHASE_TRAINER ) m_index = 0; @@ -712,21 +708,19 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_MISSION ) m_index = 2; if ( m_phase == PHASE_FREE ) m_index = 3; if ( m_phase == PHASE_USER ) m_index = 4; - if ( m_phase == PHASE_TEEN ) m_index = 6; if ( m_phase == PHASE_FREE ) { - strcpy(m_sceneName, "scene"); + strcpy(m_sceneName, "missions"); ReadGamerInfo(); m_accessChap = GetChapPassed(); } - if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "train"); - if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "defi" ); - if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "scene"); - if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free"); - if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen"); - if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user"); + if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "exercises"); + if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "challenges" ); + if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "missions"); + if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "freemissions"); + if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "custom"); ReadGamerInfo(); @@ -740,7 +734,6 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_DEFI ) res = RT_TITLE_DEFI; if ( m_phase == PHASE_MISSION ) res = RT_TITLE_MISSION; if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE; - if ( m_phase == PHASE_TEEN ) res = RT_TITLE_TEEN; if ( m_phase == PHASE_USER ) res = RT_TITLE_USER; GetResource(RES_TEXT, res, name); pw->SetName(name); @@ -765,7 +758,6 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_DEFI ) res = RT_PLAY_CHAPd; if ( m_phase == PHASE_MISSION ) res = RT_PLAY_CHAPm; if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf; - if ( m_phase == PHASE_TEEN ) res = RT_PLAY_CHAPte; if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name); @@ -788,7 +780,6 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_DEFI ) res = RT_PLAY_LISTd; if ( m_phase == PHASE_MISSION ) res = RT_PLAY_LISTm; if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf; - if ( m_phase == PHASE_TEEN ) res = RT_PLAY_LISTk; if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu; GetResource(RES_TEXT, res, name); pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name); @@ -825,8 +816,7 @@ void CMainDialog::ChangePhase(Phase phase) // Button displays the "soluce": if ( m_phase != PHASE_TRAINER && - m_phase != PHASE_FREE && - m_phase != PHASE_TEEN ) + m_phase != PHASE_FREE ) { pos.x = ox+sx*9.5f; pos.y = oy+sy*5.8f; @@ -883,7 +873,7 @@ void CMainDialog::ChangePhase(Phase phase) pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK); pb->SetState(STATE_SHADOW); - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1008,7 +998,7 @@ void CMainDialog::ChangePhase(Phase phase) if ( !m_bSimulSetup ) { - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1500,7 +1490,7 @@ void CMainDialog::ChangePhase(Phase phase) if ( m_phase == PHASE_READ ) { - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1547,7 +1537,7 @@ void CMainDialog::ChangePhase(Phase phase) pl->SetFontSize(12.0f); pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER); - m_engine->SetBackground("interface.png", + m_engine->SetBackground("interface/interface.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1569,7 +1559,7 @@ void CMainDialog::ChangePhase(Phase phase) m_engine->SetOverColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok? m_engine->SetOverFront(true); - m_engine->SetBackground("ppc.png", + m_engine->SetBackground("interface/ppc.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1588,7 +1578,7 @@ void CMainDialog::ChangePhase(Phase phase) m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok? m_engine->SetOverFront(true); - m_engine->SetBackground("colobot.png", + m_engine->SetBackground("interface/colobot.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1607,7 +1597,7 @@ void CMainDialog::ChangePhase(Phase phase) m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok? m_engine->SetOverFront(true); - m_engine->SetBackground("epsitec.png", + m_engine->SetBackground("interface/epsitec.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1673,7 +1663,7 @@ void CMainDialog::ChangePhase(Phase phase) pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT); pb->SetState(STATE_SHADOW); - m_engine->SetBackground("generico.png", + m_engine->SetBackground("interface/generico.png", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), @@ -1688,7 +1678,6 @@ void CMainDialog::ChangePhase(Phase phase) m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER || m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPg || @@ -1952,10 +1941,6 @@ bool CMainDialog::EventProcess(const Event &event) m_main->ChangePhase(PHASE_FREE); break; - case EVENT_INTERFACE_TEEN: - m_main->ChangePhase(PHASE_TEEN); - break; - case EVENT_INTERFACE_USER: m_main->ChangePhase(PHASE_USER); break; @@ -2162,7 +2147,6 @@ bool CMainDialog::EventProcess(const Event &event) m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); @@ -2181,7 +2165,6 @@ bool CMainDialog::EventProcess(const Event &event) m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { switch( event.type ) @@ -2324,7 +2307,6 @@ bool CMainDialog::EventProcess(const Event &event) { switch( event.type ) { - case EVENT_LIST1: case EVENT_LIST2: UpdateApply(); break; @@ -2356,8 +2338,7 @@ bool CMainDialog::EventProcess(const Event &event) if ( pb == 0 ) break; pb->ClearState(STATE_PRESS); pb->ClearState(STATE_HILIGHT); - // TODO: uncomment when changing display is implemented - //ChangeDisplay(); + ChangeDisplay(); UpdateApply(); break; @@ -2831,7 +2812,6 @@ void CMainDialog::GlintMove() m_phase == PHASE_TRAINER || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl)); @@ -3056,7 +3036,6 @@ void CMainDialog::FrameParticle(float rTime) m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER || m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPg || @@ -3297,40 +3276,15 @@ void CMainDialog::NiceParticle(Math::Point mouse, bool bPress) -// Specifies the special user folder if needed. - -void CMainDialog::SetUserDir(char *base, int rank) -{ - std::string dir; - - if ( strcmp(base, "user") == 0 && rank >= 100 ) - { - dir = m_userDir + "/" + m_userList.at(rank/100-1); - GetProfile().SetUserDir(dir); - } - else - { - GetProfile().SetUserDir(""); - } -} - // Builds the file name of a mission. -void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank) +void CMainDialog::BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile) { - std::ostringstream rankStream; - if ( strcmp(base, "user") == 0 ) - { - //TODO: Change this to point user dir according to operating system - rankStream << std::setfill('0') << std::setw(2) << rank%100; - filename = m_userDir + "/" + m_userList[rank/100-1] + "/" + rankStream.str() + ".txt"; - } - else - { - rankStream << std::setfill('0') << std::setw(3) << rank; - filename = base + rankStream.str() + ".txt"; - filename = CGameData::GetInstancePointer()->GetFilePath(DIR_LEVEL, filename); - } + //TODO: Support for more than 9 chapters + int chapter = rank/100; + int new_rank = rank%100; + + filename = CLevelParser::BuildSceneName(std::string(base), chapter, new_rank, sceneFile); } // Built the default descriptive name of a mission. @@ -3368,13 +3322,13 @@ void CMainDialog::ReadNameList() try { - if (! fs::exists(m_savegameDir) && fs::is_directory(m_savegameDir)) + if (! fs::exists(GetSavegameDir()) && fs::is_directory(GetSavegameDir())) { GetLogger()->Error("Savegame dir does not exist %s\n",dir); } else { - fs::directory_iterator dirIt(m_savegameDir), dirEndIt; + fs::directory_iterator dirIt(GetSavegameDir()), dirEndIt; for (; dirIt != dirEndIt; ++dirIt) { @@ -3568,7 +3522,7 @@ void CMainDialog::NameSelect() GetGamerFace(m_main->GetGamerName()); - GetProfile().SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName()); + GetProfile().SetStringProperty("Gamer", "LastName", m_main->GetGamerName()); } // Creates a new player. @@ -3582,7 +3536,7 @@ void CMainDialog::NameCreate() char c; int len, i, j; - GetLogger()->Debug("Creating new player\n"); + GetLogger()->Info("Creating new player\n"); pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == 0 ) return; pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT)); @@ -3619,13 +3573,16 @@ void CMainDialog::NameCreate() return; } - // TODO: _mkdir(m_savegameDir); // if does not exist yet! - - dir = m_savegameDir + "/" + name; + if(!CResourceManager::DirectoryExists(GetPHYSFSSavegameDir())) + CResourceManager::CreateDirectory(GetPHYSFSSavegameDir()); + + dir = GetSavegameDir() + "/" + name; if (!fs::exists(dir)) { fs::create_directories(dir); + if(!CResourceManager::DirectoryExists(GetPHYSFSSavegameDir()+"/"+name)) + CResourceManager::CreateDirectory(GetPHYSFSSavegameDir()+"/"+name); } else { @@ -3692,7 +3649,7 @@ void CMainDialog::NameDelete() gamer = pl->GetItemName(sel); // Deletes all the contents of the file. - sprintf(dir, "%s/%s", m_savegameDir.c_str(), gamer); + sprintf(dir, "%s/%s", GetSavegameDir().c_str(), gamer); if ( !RemoveDir(dir) ) { m_sound->Play(SOUND_TZOING); @@ -4005,7 +3962,7 @@ bool CMainDialog::IsIOReadScene() { fs::directory_iterator end_iter; - fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName()); + fs::path saveDir(GetSavegameDir() + "/" + m_main->GetGamerName()); if (fs::exists(saveDir) && fs::is_directory(saveDir)) { for( fs::directory_iterator dir_iter(saveDir) ; dir_iter != end_iter ; ++dir_iter) @@ -4024,7 +3981,6 @@ bool CMainDialog::IsIOReadScene() void CMainDialog::IOReadName() { - FILE* file; CWindow* pw; CEdit* pe; std::string filename; @@ -4046,10 +4002,12 @@ void CMainDialog::IOReadName() sprintf(op, "Title.E"); sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar() ); - file = fopen(filename.c_str(), "r"); - if ( file != NULL ) + CInputStream stream; + stream.open(filename); + + if (stream.is_open()) { - while ( fgets(line, 500, file) != NULL ) + while (stream.getline(line, 500)) { for ( i=0 ; i<500 ; i++ ) { @@ -4071,7 +4029,7 @@ void CMainDialog::IOReadName() break; } } - fclose(file); + stream.close(); } time(&now); @@ -4101,7 +4059,7 @@ void CMainDialog::IOReadList() pl->Flush(); - fs::path saveDir(m_savegameDir + "/" + m_main->GetGamerName()); + fs::path saveDir(GetSavegameDir() + "/" + m_main->GetGamerName()); m_saveList.clear(); if (fs::exists(saveDir) && fs::is_directory(saveDir)) @@ -4278,7 +4236,7 @@ bool CMainDialog::IOWriteScene() pe->GetText(info, 100); if (static_cast<unsigned int>(sel) >= m_saveList.size()) { - dir = fs::path(m_savegameDir) / m_main->GetGamerName() / ("save" + clearName(info)); + dir = fs::path(GetSavegameDir()) / m_main->GetGamerName() / ("save" + clearName(info)); } else { @@ -4405,7 +4363,6 @@ void CMainDialog::AllMissionUpdate() m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { UpdateSceneChap(m_chap[m_index]); @@ -4417,10 +4374,9 @@ void CMainDialog::AllMissionUpdate() void CMainDialog::UpdateSceneChap(int &chap) { - FILE* file = NULL; CWindow* pw; CList* pl; - //struct _finddata_t fileBuffer; + std::string fileName; char op[100]; char op_i18n[100]; @@ -4444,60 +4400,25 @@ void CMainDialog::UpdateSceneChap(int &chap) if ( m_phase == PHASE_USER ) { j = 0; - fs::directory_iterator dirIt(m_savegameDir), dirEndIt; - m_userList.clear(); - - for (; dirIt != dirEndIt; ++dirIt) - { - const fs::path& p = *dirIt; - if (fs::is_directory(p)) - { - m_userList.push_back(p.leaf().string()); - } - } + auto userLevelDirs = CResourceManager::ListDirectories("levels/custom/"); + std::sort(userLevelDirs.begin(), userLevelDirs.end()); + m_userList = userLevelDirs; m_userTotal = m_userList.size(); for ( j=0 ; j<m_userTotal ; j++ ) { - BuildSceneName(fileName, m_sceneName, (j+1)*100); - file = fopen(fileName.c_str(), "r"); - if ( file == NULL ) - { - strcpy(name, m_userList[j].c_str()); + try { + CLevelParser* level = new CLevelParser("custom", j+1, 0); + level->Load(); + pl->SetItemName(j, level->Get("Title")->GetParam("text")->AsString().c_str()); + pl->SetEnable(j, true); + delete level; } - else + catch(CLevelParserException& e) { - BuildResumeName(name, m_sceneName, j+1); // default name - sprintf(op, "Title.E"); - sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar()); - - while ( fgets(line, 500, file) != NULL ) - { - for ( i=0 ; i<500 ; i++ ) - { - if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space - if ( line[i] == '/' && line[i+1] == '/' ) - { - line[i] = 0; - break; - } - } - - if ( Cmd(line, op) ) - { - OpString(line, "text", name); - } - if ( Cmd(line, op_i18n) ) - { - OpString(line, "text", name); - break; - } - } - fclose(file); + pl->SetItemName(j, (std::string("[ERROR]: ")+e.what()).c_str()); + pl->SetEnable(j, false); } - - pl->SetItemName(j, name); - pl->SetEnable(j, true); } } else @@ -4505,14 +4426,15 @@ void CMainDialog::UpdateSceneChap(int &chap) for ( j=0 ; j<9 ; j++ ) { BuildSceneName(fileName, m_sceneName, (j+1)*100); - file = fopen(fileName.c_str(), "r"); - if ( file == NULL ) break; + CInputStream stream; + stream.open(fileName); + if (!stream.is_open()) break; BuildResumeName(name, m_sceneName, j+1); // default name sprintf(op, "Title.E"); sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar()); - while ( fgets(line, 500, file) != NULL ) + while (stream.getline(line, 500)) { for ( i=0 ; i<500 ; i++ ) { @@ -4534,7 +4456,7 @@ void CMainDialog::UpdateSceneChap(int &chap) break; } } - fclose(file); + stream.close(); bPassed = GetGamerInfoPassed((j+1)*100); sprintf(line, "%d: %s", j+1, name); @@ -4566,7 +4488,6 @@ void CMainDialog::UpdateSceneChap(int &chap) void CMainDialog::UpdateSceneList(int chap, int &sel) { - FILE* file = NULL; CWindow* pw; CList* pl; std::string fileName; @@ -4588,18 +4509,22 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) if ( pl == 0 ) return; pl->Flush(); + + if(chap < 0) return; for ( j=0 ; j<99 ; j++ ) { BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); - file = fopen(fileName.c_str(), "r"); - if ( file == NULL ) break; + + CInputStream stream; + stream.open(fileName); + if (!stream.is_open()) break; BuildResumeName(name, m_sceneName, j+1); // default name sprintf(op, "Title.E"); sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar()); - while ( fgets(line, 500, file) != NULL ) + while (stream.getline(line, 500)) { for ( i=0 ; i<500 ; i++ ) { @@ -4621,7 +4546,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) break; } } - fclose(file); + stream.close(); bPassed = GetGamerInfoPassed((chap+1)*100+(j+1)); sprintf(line, "%d: %s", j+1, name); @@ -4636,6 +4561,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) } } + /* TODO: ????? BuildSceneName(fileName, m_sceneName, (chap+1)*100+(j+1)); file = fopen(fileName.c_str(), "r"); if ( file == NULL ) @@ -4646,7 +4572,8 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) { m_maxList = j+1; // this is not the last! fclose(file); - } + }*/ + m_maxList = j; if ( sel > j-1 ) sel = j-1; @@ -4666,7 +4593,6 @@ void CMainDialog::ShowSoluceUpdate() m_phase == PHASE_DEFI || m_phase == PHASE_MISSION || m_phase == PHASE_FREE || - m_phase == PHASE_TEEN || m_phase == PHASE_USER ) { m_bSceneSoluce = false; @@ -4697,16 +4623,11 @@ void CMainDialog::ShowSoluceUpdate() void CMainDialog::UpdateSceneResume(int rank) { - FILE* file = NULL; CWindow* pw; CEdit* pe; CCheck* pc; std::string fileName; - char op[100]; - char op_i18n[100]; - char line[500]; - char name[500]; - int i, numTry; + int numTry; bool bPassed, bVisible; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); @@ -4732,80 +4653,18 @@ void CMainDialog::UpdateSceneResume(int rank) m_bSceneSoluce = false; } } - - BuildSceneName(fileName, m_sceneName, rank); - sprintf(op, "Resume.E"); - sprintf(op_i18n, "Resume.%c", m_app->GetLanguageChar()); - - file = fopen(fileName.c_str(), "r"); - if ( file == NULL ) return; - - name[0] = 0; - while ( fgets(line, 500, file) != NULL ) - { - for ( i=0 ; i<500 ; i++ ) - { - if (line[i] == 0) - break; - - if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space - if ( line[i] == '/' && line[i+1] == '/' ) - { - line[i] = 0; - break; - } - } - - if ( Cmd(line, op) ) - { - OpString(line, "text", name); - } - if ( Cmd(line, op_i18n) ) - { - OpString(line, "text", name); - break; - } + + if(rank<100) return; + + try { + CLevelParser* level = new CLevelParser(m_sceneName, rank/100, rank%100); + level->Load(); + pe->SetText(level->Get("Resume")->GetParam("text")->AsString().c_str()); } - fclose(file); - - pe->SetText(name); -} - -// Updates the list of devices. - -void CMainDialog::UpdateDisplayDevice() -{ - CWindow* pw; - CList* pl; - char bufDevices[1000]; - //char bufModes[5000]; - int i, j; - - pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); - if ( pw == 0 ) return; - pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1)); - if ( pl == 0 ) return; - pl->Flush(); - - //bufModes[0] = 0; - /* TODO: remove device choice - m_engine->EnumDevices(bufDevices, 1000, - bufModes, 5000, - totalDevices, selectDevices, - totalModes, selectModes);*/ - - i = 0; - j = 0; - while ( bufDevices[i] != 0 ) + catch(CLevelParserException& e) { - pl->SetItemName(j++, bufDevices+i); - while ( bufDevices[i++] != 0 ); + pe->SetText((std::string("[ERROR]: ")+e.what()).c_str()); } - - pl->SetSelect(0); - pl->ShowSelect(false); - - m_setupSelDevice = 0; } // Updates the list of modes. @@ -4843,36 +4702,28 @@ void CMainDialog::ChangeDisplay() CWindow* pw; CList* pl; CCheck* pc; - //char* device; - //char* mode; bool bFull; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == 0 ) return; - pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1)); - if ( pl == 0 ) return; - m_setupSelDevice = pl->GetSelect(); - //device = pl->GetItemName(m_setupSelDevice); - pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2)); if ( pl == 0 ) return; m_setupSelMode = pl->GetSelect(); - //mode = pl->GetItemName(m_setupSelMode); pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL)); if ( pc == 0 ) return; bFull = pc->TestState(STATE_CHECK); m_setupFull = bFull; - - // TODO: remove device choice - // m_engine->ChangeDevice(device, mode, bFull); - - if ( m_bSimulSetup ) - { - m_main->ChangeColor(); - m_main->UpdateMap(); - } + + + std::vector<Math::IntPoint> modes; + m_app->GetVideoResolutionList(modes, true, true); + + Gfx::GLDeviceConfig config = m_app->GetVideoConfig(); + config.size = modes[m_setupSelMode]; + config.fullScreen = bFull; + m_app->ChangeVideoConfig(config); } @@ -4885,18 +4736,13 @@ void CMainDialog::UpdateApply() CButton* pb; CList* pl; CCheck* pc; - int sel1, sel2; + int sel2; bool bFull; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5)); if ( pw == 0 ) return; pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_APPLY)); - if ( pb == 0 ) return; - - pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1)); - if ( pl == 0 ) return; - sel1 = pl->GetSelect(); pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2)); if ( pl == 0 ) return; @@ -4905,8 +4751,7 @@ void CMainDialog::UpdateApply() pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL)); bFull = pc->TestState(STATE_CHECK); - if ( sel1 == m_setupSelDevice && - sel2 == m_setupSelMode && + if ( sel2 == m_setupSelMode && bFull == m_setupFull ) { pb->ClearState(STATE_ENABLE); @@ -5199,47 +5044,45 @@ void CMainDialog::ChangeSetupButtons() void CMainDialog::SetupMemorize() { - GetProfile().SetLocalProfileString("Directory", "scene", m_sceneDir); - GetProfile().SetLocalProfileString("Directory", "savegame", m_savegameDir); - GetProfile().SetLocalProfileString("Directory", "public", m_publicDir); - GetProfile().SetLocalProfileString("Directory", "user", m_userDir); - GetProfile().SetLocalProfileString("Directory", "files", m_filesDir); - GetProfile().SetLocalProfileInt("Setup", "Tooltips", m_bTooltip); - GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bGlint); - GetProfile().SetLocalProfileInt("Setup", "InterfaceGlint", m_bRain); - GetProfile().SetLocalProfileInt("Setup", "Soluce4", m_bSoluce4); - GetProfile().SetLocalProfileInt("Setup", "Movies", m_bMovies); - GetProfile().SetLocalProfileInt("Setup", "NiceReset", m_bNiceReset); - GetProfile().SetLocalProfileInt("Setup", "HimselfDamage", m_bHimselfDamage); - GetProfile().SetLocalProfileInt("Setup", "CameraScroll", m_bCameraScroll); - GetProfile().SetLocalProfileInt("Setup", "CameraInvertX", m_bCameraInvertX); - GetProfile().SetLocalProfileInt("Setup", "CameraInvertY", m_bCameraInvertY); - GetProfile().SetLocalProfileInt("Setup", "InterfaceEffect", m_bEffect); - GetProfile().SetLocalProfileInt("Setup", "Blood", m_bBlood); - GetProfile().SetLocalProfileInt("Setup", "GroundShadow", m_engine->GetShadow()); - GetProfile().SetLocalProfileInt("Setup", "GroundSpot", m_engine->GetGroundSpot()); - GetProfile().SetLocalProfileInt("Setup", "ObjectDirty", m_engine->GetDirty()); - GetProfile().SetLocalProfileInt("Setup", "FogMode", m_engine->GetFog()); - GetProfile().SetLocalProfileInt("Setup", "LensMode", m_engine->GetLensMode()); - GetProfile().SetLocalProfileInt("Setup", "SkyMode", m_engine->GetSkyMode()); - GetProfile().SetLocalProfileInt("Setup", "PlanetMode", m_engine->GetPlanetMode()); - GetProfile().SetLocalProfileInt("Setup", "LightMode", m_engine->GetLightMode()); - GetProfile().SetLocalProfileFloat("Setup", "ParticleDensity", m_engine->GetParticleDensity()); - GetProfile().SetLocalProfileFloat("Setup", "ClippingDistance", m_engine->GetClippingDistance()); - GetProfile().SetLocalProfileFloat("Setup", "ObjectDetail", m_engine->GetObjectDetail()); - GetProfile().SetLocalProfileFloat("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity()); - GetProfile().SetLocalProfileInt("Setup", "TextureQuality", m_engine->GetTextureQuality()); - GetProfile().SetLocalProfileInt("Setup", "TotoMode", m_engine->GetTotoMode()); - GetProfile().SetLocalProfileInt("Setup", "AudioVolume", m_sound->GetAudioVolume()); - GetProfile().SetLocalProfileInt("Setup", "MusicVolume", m_sound->GetMusicVolume()); - GetProfile().SetLocalProfileInt("Setup", "EditIndentMode", m_engine->GetEditIndentMode()); - GetProfile().SetLocalProfileInt("Setup", "EditIndentValue", m_engine->GetEditIndentValue()); + GetProfile().SetStringProperty("Directory", "savegame", m_savegameDir); + GetProfile().SetStringProperty("Directory", "public", m_publicDir); + GetProfile().SetStringProperty("Directory", "files", m_filesDir); + GetProfile().SetIntProperty("Setup", "Tooltips", m_bTooltip); + GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint); + GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bRain); + GetProfile().SetIntProperty("Setup", "Soluce4", m_bSoluce4); + GetProfile().SetIntProperty("Setup", "Movies", m_bMovies); + GetProfile().SetIntProperty("Setup", "NiceReset", m_bNiceReset); + GetProfile().SetIntProperty("Setup", "HimselfDamage", m_bHimselfDamage); + GetProfile().SetIntProperty("Setup", "CameraScroll", m_bCameraScroll); + GetProfile().SetIntProperty("Setup", "CameraInvertX", m_bCameraInvertX); + GetProfile().SetIntProperty("Setup", "CameraInvertY", m_bCameraInvertY); + GetProfile().SetIntProperty("Setup", "InterfaceEffect", m_bEffect); + GetProfile().SetIntProperty("Setup", "Blood", m_bBlood); + GetProfile().SetIntProperty("Setup", "GroundShadow", m_engine->GetShadow()); + GetProfile().SetIntProperty("Setup", "GroundSpot", m_engine->GetGroundSpot()); + GetProfile().SetIntProperty("Setup", "ObjectDirty", m_engine->GetDirty()); + GetProfile().SetIntProperty("Setup", "FogMode", m_engine->GetFog()); + GetProfile().SetIntProperty("Setup", "LensMode", m_engine->GetLensMode()); + GetProfile().SetIntProperty("Setup", "SkyMode", m_engine->GetSkyMode()); + GetProfile().SetIntProperty("Setup", "PlanetMode", m_engine->GetPlanetMode()); + GetProfile().SetIntProperty("Setup", "LightMode", m_engine->GetLightMode()); + GetProfile().SetFloatProperty("Setup", "ParticleDensity", m_engine->GetParticleDensity()); + GetProfile().SetFloatProperty("Setup", "ClippingDistance", m_engine->GetClippingDistance()); + GetProfile().SetFloatProperty("Setup", "ObjectDetail", m_engine->GetObjectDetail()); + GetProfile().SetFloatProperty("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity()); + GetProfile().SetIntProperty("Setup", "TextureQuality", m_engine->GetTextureQuality()); + GetProfile().SetIntProperty("Setup", "TotoMode", m_engine->GetTotoMode()); + GetProfile().SetIntProperty("Setup", "AudioVolume", m_sound->GetAudioVolume()); + GetProfile().SetIntProperty("Setup", "MusicVolume", m_sound->GetMusicVolume()); + GetProfile().SetIntProperty("Setup", "EditIndentMode", m_engine->GetEditIndentMode()); + GetProfile().SetIntProperty("Setup", "EditIndentValue", m_engine->GetEditIndentValue()); /* screen setup */ if (m_setupFull) - GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 1); + GetProfile().SetIntProperty("Setup", "Fullscreen", 1); else - GetProfile().SetLocalProfileInt("Setup", "Fullscreen", 0); + GetProfile().SetIntProperty("Setup", "Fullscreen", 0); CList *pl; CWindow *pw; @@ -5249,7 +5092,7 @@ void CMainDialog::SetupMemorize() pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2)); if ( pl != 0 ) { - GetProfile().SetLocalProfileInt("Setup", "Resolution", pl->GetSelect()); + GetProfile().SetIntProperty("Setup", "Resolution", pl->GetSelect()); } } else @@ -5266,9 +5109,9 @@ void CMainDialog::SetupMemorize() key << b.secondary << " "; } - GetProfile().SetLocalProfileString("Setup", "KeyMap", key.str()); + GetProfile().SetStringProperty("Setup", "KeyMap", key.str()); - GetProfile().SetLocalProfileInt("Setup", "DeleteGamer", m_bDeleteGamer); + GetProfile().SetIntProperty("Setup", "DeleteGamer", m_bDeleteGamer); } // Remember all the settings. @@ -5279,48 +5122,38 @@ void CMainDialog::SetupRecall() int iValue; std::string key; - if ( GetProfile().GetLocalProfileString("Directory", "scene", key) ) - { - m_sceneDir = key; - } - - if ( GetProfile().GetLocalProfileString("Directory", "savegame", key) ) + if ( GetProfile().GetStringProperty("Directory", "savegame", key) ) { m_savegameDir = key; } - if ( GetProfile().GetLocalProfileString("Directory", "public", key) ) + if ( GetProfile().GetStringProperty("Directory", "public", key) ) { m_publicDir = key; } - if ( GetProfile().GetLocalProfileString("Directory", "user", key) ) - { - m_userDir = key; - } - - if ( GetProfile().GetLocalProfileString("Directory", "files", key) ) + if ( GetProfile().GetStringProperty("Directory", "files", key) ) { m_filesDir = key; } - if ( GetProfile().GetLocalProfileInt("Setup", "TotoMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "TotoMode", iValue) ) { m_engine->SetTotoMode(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "Tooltips", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Tooltips", iValue) ) { m_bTooltip = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) ) { m_bGlint = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceGlint", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) ) { m_bRain = iValue; } @@ -5331,91 +5164,91 @@ void CMainDialog::SetupRecall() // m_engine->SetNiceMouse(iValue); // } - if ( GetProfile().GetLocalProfileInt("Setup", "Soluce4", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Soluce4", iValue) ) { m_bSoluce4 = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "Movies", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Movies", iValue) ) { m_bMovies = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "NiceReset", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "NiceReset", iValue) ) { m_bNiceReset = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "HimselfDamage", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "HimselfDamage", iValue) ) { m_bHimselfDamage = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "CameraScroll", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "CameraScroll", iValue) ) { m_bCameraScroll = iValue; m_camera->SetCameraScroll(m_bCameraScroll); } - if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertX", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "CameraInvertX", iValue) ) { m_bCameraInvertX = iValue; m_camera->SetCameraInvertX(m_bCameraInvertX); } - if ( GetProfile().GetLocalProfileInt("Setup", "CameraInvertY", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "CameraInvertY", iValue) ) { m_bCameraInvertY = iValue; m_camera->SetCameraInvertY(m_bCameraInvertY); } - if ( GetProfile().GetLocalProfileInt("Setup", "InterfaceEffect", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "InterfaceEffect", iValue) ) { m_bEffect = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "Blood", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Blood", iValue) ) { m_bBlood = iValue; } - - if ( GetProfile().GetLocalProfileInt("Setup", "GroundShadow", iValue) ) + + if ( GetProfile().GetIntProperty("Setup", "GroundShadow", iValue) ) { m_engine->SetShadow(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "GroundSpot", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "GroundSpot", iValue) ) { m_engine->SetGroundSpot(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "ObjectDirty", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "ObjectDirty", iValue) ) { m_engine->SetDirty(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "FogMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "FogMode", iValue) ) { m_engine->SetFog(iValue); m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok? } - if ( GetProfile().GetLocalProfileInt("Setup", "LensMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "LensMode", iValue) ) { m_engine->SetLensMode(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "SkyMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "SkyMode", iValue) ) { m_engine->SetSkyMode(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "PlanetMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "PlanetMode", iValue) ) { m_engine->SetPlanetMode(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "LightMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "LightMode", iValue) ) { m_engine->SetLightMode(iValue); } @@ -5425,52 +5258,52 @@ void CMainDialog::SetupRecall() // m_engine->SetJoystick(iValue); // } - if ( GetProfile().GetLocalProfileFloat("Setup", "ParticleDensity", fValue) ) + if ( GetProfile().GetFloatProperty("Setup", "ParticleDensity", fValue) ) { m_engine->SetParticleDensity(fValue); } - if ( GetProfile().GetLocalProfileFloat("Setup", "ClippingDistance", fValue) ) + if ( GetProfile().GetFloatProperty("Setup", "ClippingDistance", fValue) ) { m_engine->SetClippingDistance(fValue); } - if ( GetProfile().GetLocalProfileFloat("Setup", "ObjectDetail", fValue) ) + if ( GetProfile().GetFloatProperty("Setup", "ObjectDetail", fValue) ) { m_engine->SetObjectDetail(fValue); } - if ( GetProfile().GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) ) + if ( GetProfile().GetFloatProperty("Setup", "GadgetQuantity", fValue) ) { m_engine->SetGadgetQuantity(fValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "TextureQuality", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "TextureQuality", iValue) ) { m_engine->SetTextureQuality(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "AudioVolume", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "AudioVolume", iValue) ) { m_sound->SetAudioVolume(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "MusicVolume", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "MusicVolume", iValue) ) { m_sound->SetMusicVolume(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentMode", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "EditIndentMode", iValue) ) { m_engine->SetEditIndentMode(iValue); } - if ( GetProfile().GetLocalProfileInt("Setup", "EditIndentValue", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "EditIndentValue", iValue) ) { m_engine->SetEditIndentValue(iValue); } - if (GetProfile().GetLocalProfileString("Setup", "KeyMap", key)) + if (GetProfile().GetStringProperty("Setup", "KeyMap", key)) { std::stringstream skey; skey.str(key); @@ -5483,17 +5316,17 @@ void CMainDialog::SetupRecall() } } - if ( GetProfile().GetLocalProfileInt("Setup", "DeleteGamer", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "DeleteGamer", iValue) ) { m_bDeleteGamer = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "Resolution", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) ) { m_setupSelMode = iValue; } - if ( GetProfile().GetLocalProfileInt("Setup", "Fullscreen", iValue) ) + if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) ) { m_setupFull = (iValue == 1); } @@ -5875,12 +5708,6 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8)); if ( pw != 0 ) pw->ClearState(STATE_ENABLE); - pb = static_cast<CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( pb != 0 ) - { - pb->ClearState(STATE_VISIBLE); - } - m_bDialogFire = bFire; std::string name; @@ -6034,7 +5861,6 @@ void CMainDialog::FrameDialog(float rTime) void CMainDialog::StopDialog() { CWindow* pw; - CButton* pb; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw != 0 ) pw->SetState(STATE_ENABLE); @@ -6063,12 +5889,6 @@ void CMainDialog::StopDialog() pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8)); if ( pw != 0 ) pw->SetState(STATE_ENABLE); - pb = static_cast<CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( pb != 0 ) - { - pb->SetState(STATE_VISIBLE); - } - StopSuspend(); m_interface->DeleteControl(EVENT_WINDOW9); m_bDialog = false; @@ -6197,7 +6017,13 @@ bool CMainDialog::GetSceneSoluce() // Returns the name of the folder to save. -std::string & CMainDialog::GetSavegameDir() +std::string CMainDialog::GetSavegameDir() +{ + return CResourceManager::GetSaveLocation()+"/"+m_savegameDir; +} + +//TODO: Use PHYSFS everywhere +std::string & CMainDialog::GetPHYSFSSavegameDir() { return m_savegameDir; } @@ -6255,7 +6081,7 @@ void CMainDialog::WriteGamerPerso(char *gamer) char filename[100]; char line[100]; - sprintf(filename, "%s/%s/face.gam", m_savegameDir.c_str(), gamer); + sprintf(filename, "%s/%s/face.gam", GetSavegameDir().c_str(), gamer); file = fopen(filename, "w"); if ( file == NULL ) return; @@ -6288,7 +6114,7 @@ void CMainDialog::ReadGamerPerso(char *gamer) m_perso.face = 0; DefPerso(); - sprintf(filename, "%s/%s/face.gam", m_savegameDir.c_str(), gamer); + sprintf(filename, "%s/%s/face.gam", GetSavegameDir().c_str(), gamer); file = fopen(filename, "r"); if ( file == NULL ) return; @@ -6397,7 +6223,7 @@ bool CMainDialog::ReadGamerInfo() m_sceneInfo[i].bPassed = false; } - sprintf(line, "%s/%s/%s.gam", m_savegameDir.c_str(), m_main->GetGamerName(), m_sceneName); + sprintf(line, "%s/%s/%s.gam", GetSavegameDir().c_str(), m_main->GetGamerName(), m_sceneName); file = fopen(line, "r"); if ( file == NULL ) return false; @@ -6433,7 +6259,7 @@ bool CMainDialog::WriteGamerInfo() char line[100]; int i; - sprintf(line, "%s/%s/%s.gam", m_savegameDir.c_str(), m_main->GetGamerName(), m_sceneName); + sprintf(line, "%s/%s/%s.gam", GetSavegameDir().c_str(), m_main->GetGamerName(), m_sceneName); file = fopen(line, "w"); if ( file == NULL ) return false; @@ -6510,6 +6336,11 @@ bool CMainDialog::NextMission() return true; } +std::string& CMainDialog::GetUserLevelName(int id) +{ + return m_userList[id-1]; +} + } // namespace Ui diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h index 0ab7897..355b18e 100644 --- a/src/ui/maindialog.h +++ b/src/ui/maindialog.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // maindialog.h @@ -88,7 +91,8 @@ public: int GetSceneRank(); const char* GetSceneDir(); bool GetSceneSoluce(); - std::string & GetSavegameDir(); + std::string GetSavegameDir(); + std::string & GetPHYSFSSavegameDir(); std::string & GetPublicDir(); bool GetTooltip(); @@ -98,8 +102,7 @@ public: bool GetNiceReset(); bool GetHimselfDamage(); - void SetUserDir(char *base, int rank); - void BuildSceneName(std::string &filename, char *base, int rank); + void BuildSceneName(std::string &filename, char *base, int rank, bool sceneFile = true); void BuildResumeName(char *filename, char *base, int rank); std::string & GetFilesDir(); @@ -140,6 +143,8 @@ public: void AllMissionUpdate(); void ShowSoluceUpdate(); + + std::string& GetUserLevelName(int id); protected: void GlintMove(); @@ -169,7 +174,6 @@ protected: void UpdateSceneChap(int &chap); void UpdateSceneList(int chap, int &sel); void UpdateSceneResume(int rank); - void UpdateDisplayDevice(); void UpdateDisplayMode(); void ChangeDisplay(); void UpdateApply(); @@ -200,10 +204,8 @@ protected: int m_persoTab; // perso: tab selected float m_persoAngle; // perso: angle of presentation - std::string m_sceneDir; // scene folder std::string m_savegameDir; // savegame folder std::string m_publicDir; // program folder - std::string m_userDir; // user folder std::string m_filesDir; // case files int m_index; // 0..4 @@ -229,7 +231,6 @@ protected: int m_shotDelay; // number of frames before copy std::string m_shotName; // generate a file name - int m_setupSelDevice; int m_setupSelMode; bool m_setupFull; diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp index 8c81160..11b2517 100644 --- a/src/ui/mainmap.cpp +++ b/src/ui/mainmap.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/mainmap.h" diff --git a/src/ui/mainmap.h b/src/ui/mainmap.h index 9b20548..0cc7959 100644 --- a/src/ui/mainmap.h +++ b/src/ui/mainmap.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // mainmap.h diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp index f6dce4b..76fd569 100644 --- a/src/ui/mainshort.cpp +++ b/src/ui/mainshort.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/mainshort.h" diff --git a/src/ui/mainshort.h b/src/ui/mainshort.h index b185aed..1d0a327 100644 --- a/src/ui/mainshort.h +++ b/src/ui/mainshort.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // mainshort.h diff --git a/src/ui/map.cpp b/src/ui/map.cpp index c5f0062..f3f569a 100644 --- a/src/ui/map.cpp +++ b/src/ui/map.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/map.h" @@ -322,7 +324,7 @@ void CMap::Draw() m_offset = AdjustOffset(m_map[MAPMAXOBJECT - 1].pos); if ( m_fixImage[0] == 0 ) { // drawing of the relief? - m_engine->SetTexture("map.png"); + m_engine->SetTexture("textures/interface/map.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.5f + (m_offset.x - (m_half / m_zoom)) / (m_half * 2.0f); uv1.y = 0.5f - (m_offset.y + (m_half / m_zoom)) / (m_half * 2.0f); @@ -330,8 +332,10 @@ void CMap::Draw() uv2.y = 0.5f - (m_offset.y - (m_half / m_zoom)) / (m_half * 2.0f); DrawVertex(uv1, uv2, 0.97f); // drawing the map } else { // still image? - m_engine->LoadTexture(m_fixImage); - m_engine->SetTexture(m_fixImage); + std::string texFilename = m_fixImage; + texFilename = "textures/"+texFilename; + m_engine->LoadTexture(texFilename.c_str()); + m_engine->SetTexture(texFilename.c_str()); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.0f; uv1.y = 0.0f; @@ -469,7 +473,7 @@ void CMap::DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color uv2.x = 126.0f/256.0f; uv2.y = 255.0f/256.0f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); bEnding = false; @@ -529,7 +533,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo return; // flashes } - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); if ( bUp ) { @@ -672,7 +676,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo { if ( bSelect ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); if ( m_bToy ) { @@ -698,7 +702,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo { if ( m_bRadar ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 64.5f/256.0f; // blue triangle uv1.y = 240.5f/256.0f; @@ -718,7 +722,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo if ( color == MAPCOLOR_WAYPOINTb ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 192.5f/256.0f; // blue cross uv1.y = 240.5f/256.0f; @@ -728,7 +732,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo } if ( color == MAPCOLOR_WAYPOINTr ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 208.5f/256.0f; // red cross uv1.y = 240.5f/256.0f; @@ -738,7 +742,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo } if ( color == MAPCOLOR_WAYPOINTg ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 224.5f/256.0f; // green cross uv1.y = 240.5f/256.0f; @@ -748,7 +752,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo } if ( color == MAPCOLOR_WAYPOINTy ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 240.5f/256.0f; // yellow cross uv1.y = 240.5f/256.0f; @@ -758,7 +762,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo } if ( color == MAPCOLOR_WAYPOINTv ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 192.5f/256.0f; // violet cross uv1.y = 224.5f/256.0f; @@ -779,7 +783,7 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, dp = 0.5f/256.0f; - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); if ( color == MAPCOLOR_MOVE ) { @@ -894,7 +898,7 @@ void CMap::DrawHighlight(Math::Point pos) dim.x *= 2.0f+cosf(m_time*8.0f)*0.5f; dim.y *= 2.0f+cosf(m_time*8.0f)*0.5f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 160.5f/256.0f; // hilite uv1.y = 224.5f/256.0f; @@ -1052,8 +1056,8 @@ void CMap::UpdateTerrain() } } - m_engine->DeleteTexture("map.png"); - m_engine->LoadTexture("map.png", &img); + m_engine->DeleteTexture("interface/map.png"); + m_engine->LoadTexture("textures/interface/map.png", &img); } // Updates the field in the map. diff --git a/src/ui/map.h b/src/ui/map.h index 4ebe688..e1ad1a2 100644 --- a/src/ui/map.h +++ b/src/ui/map.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // map.h diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp index b3422ec..32c5818 100644 --- a/src/ui/scroll.cpp +++ b/src/ui/scroll.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/scroll.h" @@ -379,7 +381,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon) if ( icon == 0 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.0f/256.0f; // yellow rectangle uv1.y = 32.0f/256.0f; @@ -389,7 +391,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 1 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f/256.0f; // gray rectangle uv1.y = 32.0f/256.0f; @@ -399,7 +401,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 2 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f/256.0f; // blue rectangle uv1.y = 0.0f/256.0f; @@ -409,7 +411,7 @@ void CScroll::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 104.0f/256.0f; // blue line - uv1.y = 32.0f/256.0f; diff --git a/src/ui/scroll.h b/src/ui/scroll.h index c115aa4..505af09 100644 --- a/src/ui/scroll.h +++ b/src/ui/scroll.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // scroll.h diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp index a01864a..81495a7 100644 --- a/src/ui/shortcut.cpp +++ b/src/ui/shortcut.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/shortcut.h" @@ -114,7 +116,7 @@ void CShortcut::Draw() zoom = 1.0f; } - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); if ( icon != -1 ) { @@ -130,7 +132,7 @@ void CShortcut::Draw() Math::Point p1, p2, c, uv1, uv2; float dp; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); zoom = 0.9f+sinf(m_time*8.0f)*0.1f; @@ -170,7 +172,7 @@ void CShortcut::Draw() Math::Point uv1, uv2; float dp; - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 160.0f/256.0f; diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h index 6495ba0..9f3a339 100644 --- a/src/ui/shortcut.h +++ b/src/ui/shortcut.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // shortcut.h diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp index 33293d1..58fcc26 100644 --- a/src/ui/slider.cpp +++ b/src/ui/slider.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/slider.h" @@ -498,7 +500,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon) if ( icon == 0 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.0f/256.0f; // yellow rectangle uv1.y = 32.0f/256.0f; @@ -510,7 +512,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 1 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f/256.0f; // gray rectangle uv1.y = 32.0f/256.0f; @@ -522,7 +524,7 @@ void CSlider::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 224.0f/256.0f; // cursor uv1.y = 32.0f/256.0f; diff --git a/src/ui/slider.h b/src/ui/slider.h index bc38aec..c55d64b 100644 --- a/src/ui/slider.h +++ b/src/ui/slider.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // slider.h diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index f83704e..01ffd6a 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/studio.h" @@ -167,7 +169,7 @@ bool CStudio::EventProcess(const Event &event) { slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE)); if ( slider == nullptr ) return false; - m_main->SetFontSize(9.0f+slider->GetVisibleValue()*12.0f); + m_main->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f); ViewEditScript(); } @@ -573,10 +575,6 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) m_bRealTime = m_bRunning; m_script->SetStepMode(!m_bRealTime); - button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if (button != nullptr) - button->ClearState(STATE_VISIBLE); - pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); @@ -638,7 +636,7 @@ void CStudio::StartEditScript(CScript *script, std::string name, int rank) button->SetState(STATE_SHADOW); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider->SetState(STATE_SHADOW); - slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f); + slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/15.0f); pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL); button->SetState(STATE_SHADOW); @@ -854,7 +852,6 @@ bool CStudio::StopEditScript(bool bCancel) { CWindow* pw; CEdit* edit; - CButton* button; pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3)); if ( pw == nullptr ) return false; @@ -877,12 +874,6 @@ bool CStudio::StopEditScript(bool bCancel) m_interface->DeleteControl(EVENT_WINDOW3); - button = static_cast< CButton* >(m_interface->SearchControl(EVENT_BUTTON_QUIT)); - if ( button != 0 ) - { - button->SetState(STATE_VISIBLE); - } - m_pause->SetPause(m_bInitPause); m_sound->MuteAll(false); m_main->SetEditLock(false, true); @@ -1542,7 +1533,7 @@ std::string CStudio::SearchDirectory(bool bCreate) } else { - sprintf(dir, "%s/%s/Program/", m_main->GetSavegameDir(), m_main->GetGamerName()); + sprintf(dir, "%s/%s/Program/", m_main->GetPHYSFSSavegameDir(), m_main->GetGamerName()); } fs::path path = fs::path(dir); diff --git a/src/ui/studio.h b/src/ui/studio.h index d1c6a51..a11d706 100644 --- a/src/ui/studio.h +++ b/src/ui/studio.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // studio.h diff --git a/src/ui/target.cpp b/src/ui/target.cpp index 455c530..a406820 100644 --- a/src/ui/target.cpp +++ b/src/ui/target.cpp @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/target.h" diff --git a/src/ui/target.h b/src/ui/target.h index 2344e59..4f95b6c 100644 --- a/src/ui/target.h +++ b/src/ui/target.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // target.h diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 98e1e6c..7b57a2f 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #include "ui/window.h" @@ -64,34 +66,20 @@ CWindow::~CWindow() void CWindow::Flush() { - int i; - - for ( i=0 ; i<MAXWINDOW ; i++ ) + for (int i = 0 ; i < MAXWINDOW; i++) { - if ( m_table[i] != 0 ) - { - delete m_table[i]; - m_table[i] = 0; - } + delete m_table[i]; + m_table[i] = nullptr; } - if ( m_buttonReduce != 0 ) - { - delete m_buttonReduce; - m_buttonReduce = 0; - } + delete m_buttonReduce; + m_buttonReduce = nullptr; - if ( m_buttonFull != 0 ) - { - delete m_buttonFull; - m_buttonFull = 0; - } + delete m_buttonFull; + m_buttonFull = nullptr; - if ( m_buttonClose != 0 ) - { - delete m_buttonClose; - m_buttonClose = 0; - } + delete m_buttonClose; + m_buttonClose = nullptr; } @@ -583,23 +571,14 @@ void CWindow::SetName(std::string name, bool tooltip) CControl::SetName(name, tooltip); - if ( m_buttonReduce != 0 ) - { - delete m_buttonReduce; - m_buttonReduce = 0; - } + delete m_buttonReduce; + m_buttonReduce = nullptr; - if ( m_buttonFull != 0 ) - { - delete m_buttonFull; - m_buttonFull = 0; - } + delete m_buttonFull; + m_buttonFull = nullptr; - if ( m_buttonClose != 0 ) - { - delete m_buttonClose; - m_buttonClose = 0; - } + delete m_buttonClose; + m_buttonClose = nullptr; bAdjust = false; @@ -1174,7 +1153,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) if ( icon == 0 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 64.0f/256.0f; // dark blue transparent uv1.y = 64.0f/256.0f; @@ -1190,7 +1169,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 1 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f/256.0f; // white tooltip uv1.y = 0.0f/256.0f; @@ -1204,7 +1183,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 2 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f/256.0f; // yellow uv1.y = 16.0f/256.0f; @@ -1218,7 +1197,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 3 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 0.0f/256.0f; // transparent blue bar with yellow upper uv1.y = 64.0f/256.0f; @@ -1237,7 +1216,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) dim.x += 100.0f/640.0f; dim.y += 60.0f/480.0f; - m_engine->SetTexture("human.png"); + m_engine->SetTexture("textures/human.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 140.0f/256.0f; uv1.y = 32.0f/256.0f; @@ -1254,7 +1233,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) dim.x -= 20.0f/640.0f; dim.y += 0.0f/480.0f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE); uv1.x = 192.0f/256.0f; uv1.y = 32.0f/256.0f; @@ -1273,7 +1252,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) dim.x -= 20.0f/640.0f; dim.y -= 20.0f/480.0f; - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f/256.0f; uv1.y = 0.0f/256.0f; @@ -1309,7 +1288,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) dim.x -= 20.0f/640.0f; dim.y -= 20.0f/480.0f; - m_engine->SetTexture("button3.png"); + m_engine->SetTexture("textures/interface/button3.png"); uv1.x = 0.0f/256.0f; uv1.y = 224.0f/256.0f; uv2.x = 32.0f/256.0f; @@ -1320,7 +1299,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) uv2.y -= dp; DrawIcon(pos, dim, uv1, uv2); // dark blue background - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); uv1.x = 224.0f/256.0f; uv1.y = 224.0f/256.0f; uv2.x = 249.0f/256.0f; @@ -1392,7 +1371,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 5 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f/256.0f; // transparent green uv1.y = 160.0f/256.0f; @@ -1406,7 +1385,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 6 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f/256.0f; // transparent red uv1.y = 176.0f/256.0f; @@ -1420,7 +1399,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 7 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f/256.0f; // transparent blue uv1.y = 192.0f/256.0f; @@ -1434,7 +1413,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 8 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 0.0f/256.0f; // opaque orange uv1.y = 0.0f/256.0f; @@ -1450,7 +1429,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 9 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 32.0f/256.0f; // opaque gray uv1.y = 32.0f/256.0f; @@ -1470,7 +1449,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 11 ) { - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK); uv1.x = 64.0f/256.0f; // transparent yellow uv1.y = 224.0f/256.0f; @@ -1484,7 +1463,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 12 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 128.0f/256.0f; // dirty opaque gray uv1.y = 128.0f/256.0f; @@ -1500,7 +1479,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 13 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 192.0f/256.0f; // dirty opaque blue uv1.y = 128.0f/256.0f; @@ -1516,7 +1495,7 @@ void CWindow::DrawVertex(Math::Point pos, Math::Point dim, int icon) } else if ( icon == 14 ) { - m_engine->SetTexture("button1.png"); + m_engine->SetTexture("textures/interface/button1.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 160.0f/256.0f; // dirty opaque red uv1.y = 128.0f/256.0f; @@ -1542,7 +1521,7 @@ void CWindow::DrawHach(Math::Point pos, Math::Point dim) dp = 0.5f/256.0f; - m_engine->SetTexture("button2.png"); + m_engine->SetTexture("textures/interface/button2.png"); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = 64.0f/256.0f; // hatching uv1.y = 208.0f/256.0f; diff --git a/src/ui/window.h b/src/ui/window.h index 87805e2..701407e 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -1,19 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * Copyright (C) 2012, Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ // window.h |