[colobot] 180/377: Compile fix after previous commit; fix MSVC errors; added missing license headers
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:34:13 UTC 2016
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 8fa5b208c2ddf65fb45df75bc525a377098e57a0
Author: krzys-h <krzys_h at interia.pl>
Date: Wed Dec 23 17:37:26 2015 +0100
Compile fix after previous commit; fix MSVC errors; added missing license headers
---
src/CBot/CBotInstr/CBotFunction.cpp | 10 +++++-----
src/CBot/CBotInstr/CBotLogicExpr.cpp | 4 ++--
src/CBot/CBotInstr/CBotNew.cpp | 2 +-
src/CBot/CBotInstr/CBotTry.cpp | 4 ++--
src/CBot/CBotToken.cpp | 32 ++++++--------------------------
src/CBot/CBotToken.h | 16 ++++++++--------
src/CBot/CBotVar/CBotVarArray.cpp | 2 +-
src/CBot/CBotVar/CBotVarBoolean.cpp | 2 +-
src/CBot/CBotVar/CBotVarClass.cpp | 2 +-
src/CBot/CBotVar/CBotVarFloat.cpp | 2 +-
src/CBot/CBotVar/CBotVarInt.cpp | 2 +-
src/CBot/CBotVar/CBotVarPointer.cpp | 2 +-
src/CBot/CBotVar/CBotVarString.cpp | 2 +-
src/CBot/stdlib/Compilation.cpp | 19 +++++++++++++++++++
src/CBot/stdlib/Compilation.h | 19 +++++++++++++++++++
src/CBot/stdlib/FileFunctions.cpp | 19 +++++++++++++++++++
src/CBot/stdlib/MathFunctions.cpp | 34 +++++++++++++++++++++++++++-------
src/CBot/stdlib/StringFunctions.cpp | 5 -----
src/CBot/stdlib/stdlib.h | 19 +++++++++++++++++++
src/CBot/stdlib/stdlib_public.h | 19 +++++++++++++++++++
20 files changed, 153 insertions(+), 63 deletions(-)
diff --git a/src/CBot/CBotInstr/CBotFunction.cpp b/src/CBot/CBotInstr/CBotFunction.cpp
index e1a9398..141cdd7 100644
--- a/src/CBot/CBotInstr/CBotFunction.cpp
+++ b/src/CBot/CBotInstr/CBotFunction.cpp
@@ -163,7 +163,7 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
pp = p;
if ( IsOfType(p, ID_EXTERN) )
{
- func->m_extern = pp; // for the position of the word "extern"
+ func->m_extern = *pp; // for the position of the word "extern"
func->m_bExtern = true;
// func->m_bPublic = true; // therefore also public!
continue;
@@ -200,9 +200,9 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
if (!IsOfType(p, TokenTypVar)) goto bad;
}
- func->m_openpar = p;
+ func->m_openpar = *p;
func->m_Param = CBotDefParam::Compile( p, pStk );
- func->m_closepar = p->GetPrev();
+ func->m_closepar = *(p->GetPrev());
if (pStk->IsOk())
{
pStk->SetRetType(func->m_retTyp); // for knowledge what type returns
@@ -234,9 +234,9 @@ CBotFunction* CBotFunction::Compile(CBotToken* &p, CBotCStack* pStack, CBotFunct
}
// and compiles the following instruction block
- func->m_openblk = p;
+ func->m_openblk = *p;
func->m_Block = CBotBlock::Compile(p, pStk, false);
- func->m_closeblk = p->GetPrev();
+ func->m_closeblk = *(p->GetPrev());
if ( pStk->IsOk() )
{
if ( func->m_bPublic ) // public function, return known for all
diff --git a/src/CBot/CBotInstr/CBotLogicExpr.cpp b/src/CBot/CBotInstr/CBotLogicExpr.cpp
index 9e1eb4c..10e9782 100644
--- a/src/CBot/CBotInstr/CBotLogicExpr.cpp
+++ b/src/CBot/CBotInstr/CBotLogicExpr.cpp
@@ -56,7 +56,7 @@ bool CBotLogicExpr::Execute(CBotStack* &pStack)
if (!pStk1->SetState(1)) return false;
}
- if ( pStk1->GetVal() == true )
+ if (pStk1->GetVal() != 0)
{
if ( !m_op1->Execute(pStk1) ) return false;
}
@@ -82,7 +82,7 @@ void CBotLogicExpr::RestoreState(CBotStack* &pStack, bool bMain)
return;
}
- if ( pStk1->GetVal() == true )
+ if (pStk1->GetVal() != 0)
{
m_op1->RestoreState(pStk1, bMain);
}
diff --git a/src/CBot/CBotInstr/CBotNew.cpp b/src/CBot/CBotInstr/CBotNew.cpp
index 27237ed..a7446a9 100644
--- a/src/CBot/CBotInstr/CBotNew.cpp
+++ b/src/CBot/CBotInstr/CBotNew.cpp
@@ -66,7 +66,7 @@ CBotInstr* CBotNew::Compile(CBotToken* &p, CBotCStack* pStack)
CBotNew* inst = new CBotNew();
inst->SetToken(pp);
- inst->m_vartoken = p;
+ inst->m_vartoken = *p;
p = p->GetNext();
// creates the object on the "job"
diff --git a/src/CBot/CBotInstr/CBotTry.cpp b/src/CBot/CBotInstr/CBotTry.cpp
index ac89059..452abb9 100644
--- a/src/CBot/CBotInstr/CBotTry.cpp
+++ b/src/CBot/CBotInstr/CBotTry.cpp
@@ -134,7 +134,7 @@ bool CBotTry::Execute(CBotStack* &pj)
}
if ( --state <= 0 )
{
- if ( pile2->GetVal() == true )
+ if (pile2->GetVal() != 0)
{
// pile0->SetState(1);
@@ -210,7 +210,7 @@ void CBotTry::RestoreState(CBotStack* &pj, bool bMain)
}
if ( --state <= 0 )
{
- if ( pile2->GetVal() == true )
+ if (pile2->GetVal() != 0)
{
pc->RestoreState(pile2, bMain); // execute the operation
return;
diff --git a/src/CBot/CBotToken.cpp b/src/CBot/CBotToken.cpp
index 252cbf6..6c7919b 100644
--- a/src/CBot/CBotToken.cpp
+++ b/src/CBot/CBotToken.cpp
@@ -134,39 +134,19 @@ std::map<std::string, long> CBotToken::m_defineNum;
////////////////////////////////////////////////////////////////////////////////
CBotToken::CBotToken()
{
- m_next = nullptr;
- m_prev = nullptr;
- m_type = TokenTypVar; // at the beginning a default variable type
- m_keywordId = -1;
}
////////////////////////////////////////////////////////////////////////////////
CBotToken::CBotToken(const CBotToken& pSrc)
{
- m_next = nullptr;
- m_prev = nullptr;
-
- m_text.clear();
- m_sep.clear();
+ m_type = pSrc.m_type;
+ m_keywordId = pSrc.m_keywordId;
- m_type = TokenTypNone;
- m_keywordId = 0;
+ m_text = pSrc.m_text;
+ m_sep = pSrc.m_sep;
- m_start = 0;
- m_end = 0;
-
- if ( pSrc != nullptr )
- {
-
- m_type = pSrc->m_type;
- m_keywordId = pSrc->m_IdKeyWord;
-
- m_text = pSrc->m_Text;
- m_sep = pSrc->m_Sep;
-
- m_start = pSrc->m_start;
- m_end = pSrc->m_end;
- }
+ m_start = pSrc.m_start;
+ m_end = pSrc.m_end;
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/CBotToken.h b/src/CBot/CBotToken.h
index a16e52c..a2b836f 100644
--- a/src/CBot/CBotToken.h
+++ b/src/CBot/CBotToken.h
@@ -200,23 +200,23 @@ private:
private:
//! The next token in the linked list
- CBotToken* m_next;
+ CBotToken* m_next = nullptr;
//! The previous token in the linked list
- CBotToken* m_prev;
+ CBotToken* m_prev = nullptr;
//! The token type
- TokenType m_type;
+ TokenType m_type = TokenTypVar;
//! The id of the keyword
- long m_keywordId;
+ long m_keywordId = -1;
//! The token string
- std::string m_text;
+ std::string m_text = "";
//! The separator that appeared after this token
- std::string m_sep;
+ std::string m_sep = "";
//! The strat position of the token in the CBotProgram
- int m_start;
+ int m_start = 0;
//! The end position of the token in the CBotProgram
- int m_end;
+ int m_end = 0;
//! Map of all defined constants (see DefineNum())
static std::map<std::string, long> m_defineNum;
diff --git a/src/CBot/CBotVar/CBotVarArray.cpp b/src/CBot/CBotVar/CBotVarArray.cpp
index aa01b66..e4cd2c3 100644
--- a/src/CBot/CBotVar/CBotVarArray.cpp
+++ b/src/CBot/CBotVar/CBotVarArray.cpp
@@ -36,7 +36,7 @@ CBotVarArray::CBotVarArray(const CBotToken* name, CBotTypResult& type )
if ( !type.Eq(CBotTypArrayPointer) &&
!type.Eq(CBotTypArrayBody)) assert(0);
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/CBotVar/CBotVarBoolean.cpp b/src/CBot/CBotVar/CBotVarBoolean.cpp
index c7bffd7..81b8f68 100644
--- a/src/CBot/CBotVar/CBotVarBoolean.cpp
+++ b/src/CBot/CBotVar/CBotVarBoolean.cpp
@@ -28,7 +28,7 @@
////////////////////////////////////////////////////////////////////////////////
CBotVarBoolean::CBotVarBoolean( const CBotToken* name )
{
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/CBotVar/CBotVarClass.cpp b/src/CBot/CBotVar/CBotVarClass.cpp
index 5f77fcc..5937a26 100644
--- a/src/CBot/CBotVar/CBotVarClass.cpp
+++ b/src/CBot/CBotVar/CBotVarClass.cpp
@@ -45,7 +45,7 @@ CBotVarClass::CBotVarClass( const CBotToken* name, const CBotTypResult& type)
!type.Eq(CBotTypArrayPointer) &&
!type.Eq(CBotTypArrayBody)) assert(0);
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = OBJECTCREATED;//nullptr;
diff --git a/src/CBot/CBotVar/CBotVarFloat.cpp b/src/CBot/CBotVar/CBotVarFloat.cpp
index 6f93b54..1407dac 100644
--- a/src/CBot/CBotVar/CBotVarFloat.cpp
+++ b/src/CBot/CBotVar/CBotVarFloat.cpp
@@ -33,7 +33,7 @@
////////////////////////////////////////////////////////////////////////////////
CBotVarFloat::CBotVarFloat( const CBotToken* name )
{
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/CBotVar/CBotVarInt.cpp b/src/CBot/CBotVar/CBotVarInt.cpp
index 58b8cde..fec48d2 100644
--- a/src/CBot/CBotVar/CBotVarInt.cpp
+++ b/src/CBot/CBotVar/CBotVarInt.cpp
@@ -32,7 +32,7 @@
////////////////////////////////////////////////////////////////////////////////
CBotVarInt::CBotVarInt( const CBotToken* name )
{
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/CBotVar/CBotVarPointer.cpp b/src/CBot/CBotVar/CBotVarPointer.cpp
index 18b4d59..49fda50 100644
--- a/src/CBot/CBotVar/CBotVarPointer.cpp
+++ b/src/CBot/CBotVar/CBotVarPointer.cpp
@@ -40,7 +40,7 @@ CBotVarPointer::CBotVarPointer(const CBotToken* name, CBotTypResult& type )
!type.Eq(CBotTypClass) && // for convenience accepts Class and Intrinsic
!type.Eq(CBotTypIntrinsic) ) assert(0);
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/CBotVar/CBotVarString.cpp b/src/CBot/CBotVar/CBotVarString.cpp
index 48fb21e..6a5645b 100644
--- a/src/CBot/CBotVar/CBotVarString.cpp
+++ b/src/CBot/CBotVar/CBotVarString.cpp
@@ -31,7 +31,7 @@
////////////////////////////////////////////////////////////////////////////////
CBotVarString::CBotVarString( const CBotToken* name )
{
- m_token = new CBotToken(name);
+ m_token = new CBotToken(*name);
m_next = nullptr;
m_pMyThis = nullptr;
m_pUserPtr = nullptr;
diff --git a/src/CBot/stdlib/Compilation.cpp b/src/CBot/stdlib/Compilation.cpp
index fd820bf..e0f3c50 100644
--- a/src/CBot/stdlib/Compilation.cpp
+++ b/src/CBot/stdlib/Compilation.cpp
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/stdlib/Compilation.h"
#include "CBot/CBot.h"
diff --git a/src/CBot/stdlib/Compilation.h b/src/CBot/stdlib/Compilation.h
index b53519c..0b4014d 100644
--- a/src/CBot/stdlib/Compilation.h
+++ b/src/CBot/stdlib/Compilation.h
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/CBotTypResult.h"
diff --git a/src/CBot/stdlib/FileFunctions.cpp b/src/CBot/stdlib/FileFunctions.cpp
index c913d24..9861841 100644
--- a/src/CBot/stdlib/FileFunctions.cpp
+++ b/src/CBot/stdlib/FileFunctions.cpp
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/stdlib/stdlib.h"
#include "CBot/CBot.h"
diff --git a/src/CBot/stdlib/MathFunctions.cpp b/src/CBot/stdlib/MathFunctions.cpp
index 9375b92..483c078 100644
--- a/src/CBot/stdlib/MathFunctions.cpp
+++ b/src/CBot/stdlib/MathFunctions.cpp
@@ -1,8 +1,28 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/stdlib/stdlib.h"
#include "CBot/CBot.h"
#include <cmath>
+const float PI = 3.14159265358979323846f;
// Instruction "sin(degrees)".
@@ -11,7 +31,7 @@ bool rSin(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(sinf(value*M_PI/180.0f));
+ result->SetValFloat(sinf(value*PI/180.0f));
return true;
}
@@ -22,7 +42,7 @@ bool rCos(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(cosf(value*M_PI/180.0f));
+ result->SetValFloat(cosf(value*PI/180.0f));
return true;
}
@@ -33,7 +53,7 @@ bool rTan(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(tanf(value*M_PI/180.0f));
+ result->SetValFloat(tanf(value*PI/180.0f));
return true;
}
@@ -44,7 +64,7 @@ bool raSin(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(asinf(value)*180.0f/M_PI);
+ result->SetValFloat(asinf(value)*180.0f/PI);
return true;
}
@@ -55,7 +75,7 @@ bool raCos(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(acosf(value)*180.0f/M_PI);
+ result->SetValFloat(acosf(value)*180.0f/PI);
return true;
}
@@ -66,7 +86,7 @@ bool raTan(CBotVar* var, CBotVar* result, int& exception, void* user)
float value;
value = var->GetValFloat();
- result->SetValFloat(atanf(value)*180.0f/M_PI);
+ result->SetValFloat(atanf(value)*180.0f/PI);
return true;
}
@@ -78,7 +98,7 @@ bool raTan2(CBotVar* var, CBotVar* result, int& exception, void* user)
var = var->GetNext();
float x = var->GetValFloat();
- result->SetValFloat(atan2(y, x) * 180.0f / M_PI);
+ result->SetValFloat(atan2(y, x) * 180.0f / PI);
return true;
}
diff --git a/src/CBot/stdlib/StringFunctions.cpp b/src/CBot/stdlib/StringFunctions.cpp
index 6bcaaf6..324db49 100644
--- a/src/CBot/stdlib/StringFunctions.cpp
+++ b/src/CBot/stdlib/StringFunctions.cpp
@@ -17,17 +17,12 @@
* along with this program. If not, see http://gnu.org/licenses
*/
-// Modules inlcude
#include "CBot/stdlib/stdlib.h"
#include "CBot/CBot.h"
#include "CBot/CBotUtils.h"
-
-// Local include
-
-// Global include
#include <boost/algorithm/string.hpp>
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/CBot/stdlib/stdlib.h b/src/CBot/stdlib/stdlib.h
index fd75279..52d7261 100644
--- a/src/CBot/stdlib/stdlib.h
+++ b/src/CBot/stdlib/stdlib.h
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/stdlib/stdlib_public.h"
diff --git a/src/CBot/stdlib/stdlib_public.h b/src/CBot/stdlib/stdlib_public.h
index 0497906..c8f643e 100644
--- a/src/CBot/stdlib/stdlib_public.h
+++ b/src/CBot/stdlib/stdlib_public.h
@@ -1,3 +1,22 @@
+/*
+ * This file is part of the Colobot: Gold Edition source code
+ * Copyright (C) 2001-2015, Daniel Roux, EPSITEC SA & TerranovaTeam
+ * http://epsitec.ch; http://colobot.info; http://github.com/colobot
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more 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 "CBot/stdlib/Compilation.h"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list