Colobot
scene_conditions.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
27 #include "common/error.h"
28 #include "common/global.h"
29 
30 #include "math/vector.h"
31 
32 #include "object/drive_type.h"
33 #include "object/object_type.h"
34 #include "object/tool_type.h"
35 
36 class CLevelParserLine;
37 
43 {
44 public:
45  Math::Vector pos = Math::Vector(0.0f, 0.0f, 0.0f)*g_unit;
46  float dist = 8.0f*g_unit;
47  ObjectType type = OBJECT_NULL;
48  float powermin = -1; // wins if energy cell >=
49  float powermax = 100; // wins if energy cell <=
50  ToolType tool = ToolType::Other;
51  DriveType drive = DriveType::Other;
52  bool countTransported = true;
53  int team = 0;
54 
55  int min = 1; // wins if >
56  int max = 9999; // wins if <
57 
59  virtual void Read(CLevelParserLine* line);
60 
62  bool Check();
63 
64 protected:
66  int CountObjects();
67 };
68 
74 {
75 public:
76  int winTeam = 0;
77 
78  int lost = -1; // lost if <=
79 
81  bool immediat = false;
82 
84  void Read(CLevelParserLine* line) override;
85 
87  bool CheckLost();
88 
90  Error GetMissionResult();
91 };
92 
98 {
99 public:
100  std::string music = "";
101  bool repeat = true;
102 
103  bool changed = false;
104 
106  void Read(CLevelParserLine* line) override;
107 };
virtual void Read(CLevelParserLine *line)
Read from line in scene file.
Definition: scene_conditions.cpp:33
Audio change condition.
Definition: scene_conditions.h:97
ObjectType enum.
Definition: parserline.h:37
bool Check()
Checks if this condition is met.
Definition: scene_conditions.cpp:123
Scene end condition.
Definition: scene_conditions.h:73
int CountObjects()
Count all object matching the conditions.
Definition: scene_conditions.cpp:49
Base scene condition structure.
Definition: scene_conditions.h:42
Vector struct and related functions.
ObjectType
Type of game object.
Definition: object_type.h:33
3D (3x1) vector
Definition: vector.h:53