diff options
author | Krzysztof H <krzys_h@interia.pl> | 2012-03-19 12:44:39 +0100 |
---|---|---|
committer | Krzysztof H <krzys_h@interia.pl> | 2012-03-19 12:44:39 +0100 |
commit | f7d892cf4ef6bfce3747c4b6a810d4828b79833d (patch) | |
tree | 8311c7057b5f861c387ecc8c96cd778abc47c8d8 /src/CBot/CBotCompExpr.cpp | |
parent | 343cb0ce660136ac034e6106c0f151466b751398 (diff) | |
download | colobot-f7d892cf4ef6bfce3747c4b6a810d4828b79833d.tar.gz colobot-f7d892cf4ef6bfce3747c4b6a810d4828b79833d.tar.bz2 colobot-f7d892cf4ef6bfce3747c4b6a810d4828b79833d.zip |
Last coding fix ;)
Diffstat (limited to 'src/CBot/CBotCompExpr.cpp')
-rw-r--r-- | src/CBot/CBotCompExpr.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/CBot/CBotCompExpr.cpp b/src/CBot/CBotCompExpr.cpp index dada30e..41e7e05 100644 --- a/src/CBot/CBotCompExpr.cpp +++ b/src/CBot/CBotCompExpr.cpp @@ -1,4 +1,4 @@ -// * This file is part of the COLOBOT source code
+// * 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
@@ -12,7 +12,10 @@ // * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
-// * along with this program. If not, see http://www.gnu.org/licenses/.
+// * along with this program. If not, see http://www.gnu.org/licenses/.///////////////////////////////////////////////////
+// expression du genre Opérande1 > Opérande2
+// Opérande1 != Opérande2
+// etc.
#include "CBot.h"
@@ -39,7 +42,7 @@ CBotInstr* CBotCompExpr::Compile(CBotToken* &p, CBotCStack* pStack) {
CBotCStack* pStk = pStack->AddStack();
- CBotInstr* left = CBotAddExpr::Compile( p, pStk ); // expression A + B � gauche
+ CBotInstr* left = CBotAddExpr::Compile( p, pStk ); // expression A + B à gauche
if (left == NULL) return pStack->Return(NULL, pStk); // erreur
if ( p->GetType() == ID_HI ||
@@ -49,22 +52,22 @@ CBotInstr* CBotCompExpr::Compile(CBotToken* &p, CBotCStack* pStack) p->GetType() == ID_EQ ||
p->GetType() == ID_NE) // les diverses comparaisons
{
- CBotCompExpr* inst = new CBotCompExpr(); // �l�ment pour op�ration
- inst->SetToken(p); // m�morise l'op�ration
+ CBotCompExpr* inst = new CBotCompExpr(); // élément pour opération
+ inst->SetToken(p); // mémorise l'opération
int type1, type2;
type1 = pStack->GetType();
p = p->Next();
- if ( NULL != (inst->m_rightop = CBotAddExpr::Compile( p, pStk )) ) // expression A + B � droite
+ if ( NULL != (inst->m_rightop = CBotAddExpr::Compile( p, pStk )) ) // expression A + B à droite
{
type2 = pStack->GetType();
- // les r�sultats sont-ils compatibles
+ // les résultats sont-ils compatibles
if ( type1 == type2 )
{
inst->m_leftop = left;
pStk->SetVar(new CBotVar(NULL, CBotTypBoolean));
- // le r�sultat est un boolean
+ // le résultat est un boolean
return pStack->Return(inst, pStk);
}
}
@@ -78,7 +81,7 @@ CBotInstr* CBotCompExpr::Compile(CBotToken* &p, CBotCStack* pStack) }
-// fait l'op�ration
+// fait l'opération
BOOL CBotCompExpr::Execute(CBotStack* &pStack)
{
@@ -87,9 +90,9 @@ BOOL CBotCompExpr::Execute(CBotStack* &pStack) if ( pStk1->GetState() == 0 && !m_leftop->Execute(pStk1) ) return FALSE; // interrompu ici ?
- pStk1->SetState(1); // op�ration termin�e
+ pStk1->SetState(1); // opération terminée
- // demande un peu plus de stack pour ne pas toucher le r�sultat de gauche
+ // demande un peu plus de stack pour ne pas toucher le résultat de gauche
CBotStack* pStk2 = pStk1->AddStack();
if ( !m_rightop->Execute(pStk2) ) return FALSE; // interrompu ici ?
@@ -102,27 +105,27 @@ BOOL CBotCompExpr::Execute(CBotStack* &pStack) switch (GetTokenType())
{
case ID_LO:
- result->Lo(pStk1->GetVar(), pStk2->GetVar()); // inf�rieur
+ result->Lo(pStk1->GetVar(), pStk2->GetVar()); // inférieur
break;
case ID_HI:
- result->Hi(pStk1->GetVar(), pStk2->GetVar()); // sup�rieur
+ result->Hi(pStk1->GetVar(), pStk2->GetVar()); // supérieur
break;
case ID_LS:
- result->Ls(pStk1->GetVar(), pStk2->GetVar()); // inf�rieur ou �gal
+ result->Ls(pStk1->GetVar(), pStk2->GetVar()); // inférieur ou égal
break;
case ID_HS:
- result->Hs(pStk1->GetVar(), pStk2->GetVar()); // sup�rieur ou �gal
+ result->Hs(pStk1->GetVar(), pStk2->GetVar()); // supérieur ou égal
break;
case ID_EQ:
- result->Eq(pStk1->GetVar(), pStk2->GetVar()); // �gal
+ result->Eq(pStk1->GetVar(), pStk2->GetVar()); // égal
break;
case ID_NE:
- result->Ne(pStk1->GetVar(), pStk2->GetVar()); // diff�rent
+ result->Ne(pStk1->GetVar(), pStk2->GetVar()); // différent
break;
}
- pStk2->SetVar(result); // met le r�sultat sur la pile
+ pStk2->SetVar(result); // met le résultat sur la pile
- pStk1->Return(pStk2); // lib�re la pile
- return pStack->Return(pStk1); // transmet le r�sultat
+ pStk1->Return(pStk2); // libère la pile
+ return pStack->Return(pStk1); // transmet le résultat
}
|