[colobot] 73/377: Moving CBotExprNull 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 27a2c0b55aade64c57e59e8cc280ab91ce089a7d
Author: Grunaka <dev at romainbreton.fr>
Date: Wed Nov 11 17:52:41 2015 +0100
Moving CBotExprNull class in its own header and source files.
---
src/CBot/CBot.cpp | 33 +-------------------
src/CBot/CBot.h | 14 ---------
src/CBot/CBotInstr/CBotExprNull.cpp | 56 ++++++++++++++++++++++++++++++++++
src/CBot/CBotInstr/CBotExprNull.h | 60 +++++++++++++++++++++++++++++++++++++
src/CBot/CMakeLists.txt | 1 +
5 files changed, 118 insertions(+), 46 deletions(-)
diff --git a/src/CBot/CBot.cpp b/src/CBot/CBot.cpp
index b69af06..25efe2b 100644
--- a/src/CBot/CBot.cpp
+++ b/src/CBot/CBot.cpp
@@ -47,6 +47,7 @@
#include "CBotInstr/CBotExprNum.h"
#include "CBotInstr/CBotNew.h"
#include "CBotInstr/CBotExprNan.h"
+#include "CBotInstr/CBotExprNull.h"
// Local include
@@ -2742,38 +2743,6 @@ void CBotExprBool::RestoreState(CBotStack* &pj, bool bMain)
if (bMain) pj->RestoreStack(this);
}
-//////////////////////////////////////////////////////////////////////////////////////////
-
-// management of the operand "null"
-
-CBotExprNull::CBotExprNull()
-{
- name = "CBotExprNull";
-}
-
-CBotExprNull::~CBotExprNull()
-{
-}
-
-// executes, returns an empty pointer
-
-bool CBotExprNull::Execute(CBotStack* &pj)
-{
- CBotStack* pile = pj->AddStack(this);
-
- if (pile->IfStep()) return false;
- CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypNullPointer);
-
- var->SetInit(CBotVar::InitType::DEF); // null pointer valid
- pile->SetVar(var); // place on the stack
- return pj->Return(pile); // forwards below
-}
-
-void CBotExprNull::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 1e0f91e..e860c4a 100644
--- a/src/CBot/CBot.h
+++ b/src/CBot/CBot.h
@@ -963,20 +963,6 @@ public:
void RestoreState(CBotStack* &pj, bool bMain) override;
};
-
-class CBotExprNull : public CBotInstr
-{
-private:
-
-public:
- CBotExprNull();
- ~CBotExprNull();
-
- 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/CBotExprNull.cpp b/src/CBot/CBotInstr/CBotExprNull.cpp
new file mode 100644
index 0000000..0324d50
--- /dev/null
+++ b/src/CBot/CBotInstr/CBotExprNull.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "CBotExprNull.h"
+
+// Local include
+
+// Global include
+
+
+////////////////////////////////////////////////////////////////////////////////
+CBotExprNull::CBotExprNull()
+{
+ name = "CBotExprNull";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CBotExprNull::~CBotExprNull()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool CBotExprNull::Execute(CBotStack* &pj)
+{
+ CBotStack* pile = pj->AddStack(this);
+
+ if (pile->IfStep()) return false;
+ CBotVar* var = CBotVar::Create(static_cast<CBotToken*>(nullptr), CBotTypNullPointer);
+
+ var->SetInit(CBotVar::InitType::DEF); // null pointer valid
+ pile->SetVar(var); // place on the stack
+ return pj->Return(pile); // forwards below
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void CBotExprNull::RestoreState(CBotStack* &pj, bool bMain)
+{
+ if (bMain) pj->RestoreStack(this);
+}
diff --git a/src/CBot/CBotInstr/CBotExprNull.h b/src/CBot/CBotInstr/CBotExprNull.h
new file mode 100644
index 0000000..187cb26
--- /dev/null
+++ b/src/CBot/CBotInstr/CBotExprNull.h
@@ -0,0 +1,60 @@
+/*
+ * 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 CBotExprNull class Management of the operand "null".
+ */
+class CBotExprNull : public CBotInstr
+{
+public:
+
+ /*!
+ * \brief CBotExprNull
+ */
+ CBotExprNull();
+
+ /*!
+ * \brief ~CBotExprNull
+ */
+ ~CBotExprNull();
+
+ /*!
+ * \brief Execute Executes, returns an empty 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 c45dd1c..5701d39 100644
--- a/src/CBot/CMakeLists.txt
+++ b/src/CBot/CMakeLists.txt
@@ -23,6 +23,7 @@ set(SOURCES
CBotInstr/CBotExprNum.cpp
CBotInstr/CBotNew.cpp
CBotInstr/CBotExprNan.cpp
+ CBotInstr/CBotExprNull.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