[colobot] 49/377: Removed unused CBot files
Didier Raboud
odyx at moszumanska.debian.org
Wed Mar 30 13:33:56 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 7b96ae65cd28dcd89a6a374934726c32154c8f8f
Author: krzys-h <krzys_h at interia.pl>
Date: Sat Nov 21 14:52:56 2015 +0100
Removed unused CBot files
Don't even ask what they were doing here. Just don't. :P
---
src/CBot/CBot.h | 4 --
src/CBot/CBotAddExpr.cpp | 146 ----------------------------------------------
src/CBot/CBotCompExpr.cpp | 136 ------------------------------------------
src/CBot/CBotProgram.cpp | 1 +
4 files changed, 1 insertion(+), 286 deletions(-)
diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h
index d86b2f3..4437104 100644
--- a/src/CBot/CBot.h
+++ b/src/CBot/CBot.h
@@ -39,10 +39,6 @@
/////////////////////////////////////////////////////////////////////
// forward declaration
-class CBotCompExpr; // an expression like
- // () <= ()
-class CBotAddExpr; // an expression like
- // () + ()
class CBotParExpr; // basic type or instruction in parenthesis
// Toto.truc
// 12.5
diff --git a/src/CBot/CBotAddExpr.cpp b/src/CBot/CBotAddExpr.cpp
deleted file mode 100644
index 80825ea..0000000
--- a/src/CBot/CBotAddExpr.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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
- */
-
-///////////////////////////////////////////////////
-// expressions of type Operand1 + Operand2
-// Operand1 - Operand2
-
-#include "CBot.h"
-
-// various constructors
-
-CBotAddExpr::CBotAddExpr()
-{
- m_leftop =
- m_rightop = nullptr; // nullptr to be able to delete without further
- name = "CBotAddExpr"; // debug
-}
-
-CBotAddExpr::~CBotAddExpr()
-{
- delete m_leftop;
- delete m_rightop;
-}
-
-
-// compile une instruction de type A + B
-
-CBotInstr* CBotAddExpr::Compile(CBotToken* &p, CBotStack* pStack)
-{
- CBotStack* pStk = pStack->TokenStack(); // one end of stack please
-
- // looking statements that may be suitable to the left of the operation + or -
-
- CBotInstr* left = CBotMulExpr::Compile( p, pStk ); // expression A * B left
- if (left == nullptr) return pStack->Return(nullptr, pStk); // if error, transmit
-
- // do we have the token + or - next?
-
- if ( p->GetType() == ID_ADD ||
- p->GetType() == ID_SUB) // more or less
- {
- CBotAddExpr* inst = new CBotAddExpr(); // element for operation
- inst->SetToken(p); // stores the operation
-
- int type1, type2;
- type1 = pStack->GetType(); // what kind of the first operand?
-
- p = p->Next(); // skip the token of the operation
-
- // looking statements that may be suitable for right
-
- if ( nullptr != (inst->m_rightop = CBotAddExpr::Compile( p, pStk )) ) // expression (...) rigth
- {
- // there is an acceptable second operand
-
- type2 = pStack->GetType(); // what kind of results?
-
- if ( type1 == type2 ) // are the results consistent ?
- {
- // ok so, saves the operand in the object
- inst->m_leftop = left;
- // and makes the object on demand
- return pStack->Return(inst, pStk);
- }
- }
-
- // in case of error, free the elements
- delete left;
- delete inst;
- // and transmits the error that is on the stack
- return pStack->Return(nullptr, pStk);
- }
-
- // if we are not dealing with an operation + or -
- // goes to that requested, the operand (left) found
- // place the object "addition"
- return pStack->Return(left, pStk);
-}
-
-
-
-
-// operation is addition or subtraction
-
-bool CBotAddExpr::Execute(CBotStack* &pStack)
-{
- CBotStack* pStk1 = pStack->AddStack(this); // adds an item to the stack
- // or is found in case of recovery
-// if ( pSk1 == EOX ) return TRUE;
-
-
- // according to recovery, it may be in one of two states
-
- if ( pStk1->GetState() == 0 && // first state, evaluates the left operand
- !m_leftop->Execute(pStk1) ) return FALSE; // interrupted here?
-
- // passes to the next step
- pStk1->SetState(1); // ready for further
-
- // requires a little more stack to not touch the result of the left
- // which is on the stack, precisely.
-
- CBotStack* pStk2 = pStk1->AddStack(); // adds an item to the stack
- // or is found in case of recovery
-
- // Second state, evaluates the right operand
- if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrupted here?
-
- int type1 = pStk1->GetType(); // what kind of results?
- int type2 = pStk2->GetType();
-
- // creates a temporary variable to put the result
- CBotVar* result = new CBotVar( nullptr, MAX(type1, type2));
-
- // is the operation as requested
- switch (GetTokenType())
- {
- case ID_ADD:
- result->Add(pStk1->GetVar(), pStk2->GetVar()); // addition
- break;
- case ID_SUB:
- result->Sub(pStk1->GetVar(), pStk2->GetVar()); // subtraction
- break;
- }
- pStk2->SetVar(result); // puts the result on the stack
-
- pStk1->Return(pStk2); // frees the stack
- return pStack->Return(pStk1); // transmits the result
-}
-
diff --git a/src/CBot/CBotCompExpr.cpp b/src/CBot/CBotCompExpr.cpp
deleted file mode 100644
index adca89d..0000000
--- a/src/CBot/CBotCompExpr.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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
- */
-
-///////////////////////////////////////////////////
-// expression of type Opérande1 > Opérande2
-// Opérande1 != Opérande2
-// etc.
-
-#include "CBot.h"
-
-// various constructeurs
-
-CBotCompExpr::CBotCompExpr()
-{
- m_leftop =
- m_rightop = nullptr;
- name = "CBotCompExpr";
-}
-
-CBotCompExpr::~CBotCompExpr()
-{
- delete m_leftop;
- delete m_rightop;
-}
-
-fichier plus utilise;
-
-// compile instruction of type A < B
-
-CBotInstr* CBotCompExpr::Compile(CBotToken* &p, CBotCStack* pStack)
-{
- CBotCStack* pStk = pStack->AddStack();
-
- CBotInstr* left = CBotAddExpr::Compile( p, pStk ); // expression A + B left
- if (left == nullptr) return pStack->Return(nullptr, pStk); // error
-
- if ( p->GetType() == ID_HI ||
- p->GetType() == ID_LO ||
- p->GetType() == ID_HS ||
- p->GetType() == ID_LS ||
- p->GetType() == ID_EQ ||
- p->GetType() == ID_NE) // the various comparisons
- {
- CBotCompExpr* inst = new CBotCompExpr(); // element for operation
- inst->SetToken(p); // stores the operation
-
- int type1, type2;
- type1 = pStack->GetType();
-
- p = p->Next();
- if ( nullptr != (inst->m_rightop = CBotAddExpr::Compile( p, pStk )) ) // expression A + B right
- {
- type2 = pStack->GetType();
- // are the results compatible
- if ( type1 == type2 )
- {
- inst->m_leftop = left;
- pStk->SetVar(new CBotVar(nullptr, CBotTypBoolean));
- // the result is a boolean
- return pStack->Return(inst, pStk);
- }
- }
-
- delete left;
- delete inst;
- return pStack->Return(nullptr, pStk);
- }
-
- return pStack->Return(left, pStk);
-}
-
-
-// perform the operation
-
-bool CBotCompExpr::Execute(CBotStack* &pStack)
-{
- CBotStack* pStk1 = pStack->AddStack(this);
-// if ( pStk1 == EOX ) return TRUE;
-
- if ( pStk1->GetState() == 0 && !m_leftop->Execute(pStk1) ) return FALSE; // interrupted here ?
-
- pStk1->SetState(1); // finished
-
- // requires a little more stack to not touch the result of the left
- CBotStack* pStk2 = pStk1->AddStack();
-
- if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrupted here ?
-
- int type1 = pStk1->GetType();
- int type2 = pStk2->GetType();
-
- CBotVar* result = new CBotVar( nullptr, CBotTypBoolean );
-
- switch (GetTokenType())
- {
- case ID_LO:
- result->Lo(pStk1->GetVar(), pStk2->GetVar()); // lower
- break;
- case ID_HI:
- result->Hi(pStk1->GetVar(), pStk2->GetVar()); // higher
- break;
- case ID_LS:
- result->Ls(pStk1->GetVar(), pStk2->GetVar()); // lower or equal
- break;
- case ID_HS:
- result->Hs(pStk1->GetVar(), pStk2->GetVar()); // higher of equal
- break;
- case ID_EQ:
- result->Eq(pStk1->GetVar(), pStk2->GetVar()); // equal
- break;
- case ID_NE:
- result->Ne(pStk1->GetVar(), pStk2->GetVar()); // not equal
- break;
- }
- pStk2->SetVar(result); // puts the result on the stack
-
- pStk1->Return(pStk2); // frees the stack
- return pStack->Return(pStk1); // transmit the result
-}
-
diff --git a/src/CBot/CBotProgram.cpp b/src/CBot/CBotProgram.cpp
index c7bfffb..305d931 100644
--- a/src/CBot/CBotProgram.cpp
+++ b/src/CBot/CBotProgram.cpp
@@ -1042,6 +1042,7 @@ CBotTypResult cCBotDebug( CBotVar* &pVar, void* pUser )
}
+// TODO: Refactor this - including .cpp files is bad
#include "StringFunctions.cpp"
void CBotProgram::Init()
--
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