[colobot] 72/377: Moving CBotExprNan class in its own header and source files.

Didier Raboud odyx at moszumanska.debian.org
Wed Mar 30 13:33:59 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 85756b4da15386af93c1d69c450018bb9767e978
Author: Grunaka <dev at romainbreton.fr>
Date:   Wed Nov 11 17:47:44 2015 +0100

    Moving CBotExprNan class in its own header and source files.
---
 src/CBot/CBot.cpp                  | 33 +--------------------
 src/CBot/CBot.h                    | 12 --------
 src/CBot/CBotInstr/CBotExprNan.cpp | 55 +++++++++++++++++++++++++++++++++++
 src/CBot/CBotInstr/CBotExprNan.h   | 59 ++++++++++++++++++++++++++++++++++++++
 src/CBot/CMakeLists.txt            |  1 +
 5 files changed, 116 insertions(+), 44 deletions(-)

diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp
index 4c705eb..b69af06 100644
--- a/src/CBot/CBot.cpp
+++ b/src/CBot/CBot.cpp
@@ -46,6 +46,7 @@
 #include "CBotInstr/CBotExprAlpha.h"
 #include "CBotInstr/CBotExprNum.h"
 #include "CBotInstr/CBotNew.h"
+#include "CBotInstr/CBotExprNan.h"
 
 // Local include
 
@@ -2773,38 +2774,6 @@ void CBotExprNull::RestoreState(CBotStack* &pj, bool bMain)
     if (bMain) pj->RestoreStack(this);
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////
-
-// management of the operand "nan"
-
-CBotExprNan::CBotExprNan()
-{
-    name = "CBotExprNan";
-}
-
-CBotExprNan::~CBotExprNan()
-{
-}
-
-// executes, returns null pointer
-
-bool CBotExprNan::Execute(CBotStack* &pj)
-{
-    CBotStack*    pile = pj->AddStack(this);
-
-    if (pile->IfStep()) return false;
-    CBotVar*    var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypInt);
-
-    var->SetInit(CBotVar::InitType::IS_NAN);       // nan
-    pile->SetVar(var);          // put on the stack
-    return pj->Return(pile);    // forward below
-}
-
-void CBotExprNan::RestoreState(CBotStack* &pj, bool bMain)
-{
-    if (bMain) pj->RestoreStack(this);
-}
-
 //////////////////////////////////////////////////////////////////////////////////////
 // compile a variable name
 // check that it is known on the stack
diff --git a/src/CBot/CBot.h b/src/CBot/CBot.h
index 76549b0..1e0f91e 100644
--- a/src/CBot/CBot.h
+++ b/src/CBot/CBot.h
@@ -976,18 +976,6 @@ public:
     void        RestoreState(CBotStack* &pj, bool bMain) override;
 };
 
-class CBotExprNan : public CBotInstr
-{
-private:
-
-public:
-                CBotExprNan();
-                ~CBotExprNan();
-
-    bool        Execute(CBotStack* &pj) override;
-    void        RestoreState(CBotStack* &pj, bool bMain) override;
-};
-
 
 #define    MAX(a,b)    ((a>b) ? a : b)
 
diff --git a/src/CBot/CBotInstr/CBotExprNan.cpp b/src/CBot/CBotInstr/CBotExprNan.cpp
new file mode 100644
index 0000000..3eebb74
--- /dev/null
+++ b/src/CBot/CBotInstr/CBotExprNan.cpp
@@ -0,0 +1,55 @@
+/*
+ * 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
+ */
+
+// Modules inlcude
+#include "CBotExprNan.h"
+
+// Local include
+
+// Global include
+
+
+////////////////////////////////////////////////////////////////////////////////
+CBotExprNan::CBotExprNan()
+{
+    name = "CBotExprNan";
+}
+////////////////////////////////////////////////////////////////////////////////
+CBotExprNan::~CBotExprNan()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool CBotExprNan::Execute(CBotStack* &pj)
+{
+    CBotStack*    pile = pj->AddStack(this);
+
+    if (pile->IfStep()) return false;
+    CBotVar*    var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypInt);
+
+    var->SetInit(CBotVar::InitType::IS_NAN);       // nan
+    pile->SetVar(var);          // put on the stack
+    return pj->Return(pile);    // forward below
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CBotExprNan::RestoreState(CBotStack* &pj, bool bMain)
+{
+    if (bMain) pj->RestoreStack(this);
+}
diff --git a/src/CBot/CBotInstr/CBotExprNan.h b/src/CBot/CBotInstr/CBotExprNan.h
new file mode 100644
index 0000000..0d6bbf6
--- /dev/null
+++ b/src/CBot/CBotInstr/CBotExprNan.h
@@ -0,0 +1,59 @@
+/*
+ * 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
+
+// Modules inlcude
+#include "CBot.h"
+
+// Local include
+
+// Global include
+
+/*!
+ * \brief The CBotExprNan class Management of the operand "nan".
+ */
+class CBotExprNan : public CBotInstr
+{
+public:
+
+    /*!
+     * \brief CBotExprNan
+     */
+    CBotExprNan();
+
+    /*!
+     * \brief ~CBotExprNan
+     */
+    ~CBotExprNan();
+
+    /*!
+     * \brief Execute Executes, returns null pointer.
+     * \param pj
+     * \return
+     */
+    bool Execute(CBotStack* &pj) override;
+
+    /*!
+     * \brief RestoreState
+     * \param pj
+     * \param bMain
+     */
+    void RestoreState(CBotStack* &pj, bool bMain) override;
+};
diff --git a/src/CBot/CMakeLists.txt b/src/CBot/CMakeLists.txt
index 6b2aeab..c45dd1c 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -22,6 +22,7 @@ set(SOURCES
     CBotInstr/CBotExprAlpha.cpp
     CBotInstr/CBotExprNum.cpp
     CBotInstr/CBotNew.cpp
+    CBotInstr/CBotExprNan.cpp
 )
 
 # Includes

-- 
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