summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-12-29 15:03:21 +0100
committerkrzys-h <krzys_h@interia.pl>2013-12-29 15:03:21 +0100
commita36450a6dae20912ba89a9c49e8b951a20a32bfb (patch)
tree2733f24e02bf56118919340b0fc5afbf4967e849 /src/script
parentdc81cda4b1f27af6fe8abcd566ffac03255f2642 (diff)
downloadcolobot-a36450a6dae20912ba89a9c49e8b951a20a32bfb.tar.gz
colobot-a36450a6dae20912ba89a9c49e8b951a20a32bfb.tar.bz2
colobot-a36450a6dae20912ba89a9c49e8b951a20a32bfb.zip
Added tool= i drive=
Diffstat (limited to 'src/script')
-rw-r--r--src/script/cmdtoken.cpp80
-rw-r--r--src/script/cmdtoken.h6
2 files changed, 83 insertions, 3 deletions
diff --git a/src/script/cmdtoken.cpp b/src/script/cmdtoken.cpp
index 69df68b..4508459 100644
--- a/src/script/cmdtoken.cpp
+++ b/src/script/cmdtoken.cpp
@@ -535,11 +535,11 @@ const char* GetTypeObject(ObjectType type)
if ( type == OBJECT_INFO ) return "ExchangePost";
if ( type == OBJECT_ENERGY ) return "PowerPlant";
if ( type == OBJECT_LABO ) return "AutoLab";
-#if _GERMAN | _WG
+/* TODO: #if _GERMAN | _WG
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
-#else
+#else */
if ( type == OBJECT_NUCLEAR ) return "NuclearPlant";
-#endif
+/* #endif */
if ( type == OBJECT_PARA ) return "PowerCaptor";
if ( type == OBJECT_SAFE ) return "Vault";
if ( type == OBJECT_HUSTON ) return "Houston";
@@ -800,6 +800,62 @@ const char* GetCamera(Gfx::CameraType type)
return "BACK";
}
+// Returns the type of drive.
+
+DriveType GetDrive(char *line, int rank)
+{
+ char* p;
+
+ p = SearchArg(line, rank);
+ if ( *p == 0 ) return DRIVE_OTHER;
+
+ if ( Cmd(p, "Wheeled" ) ) return DRIVE_WHEELED;
+ if ( Cmd(p, "Tracked" ) ) return DRIVE_TRACKED;
+ if ( Cmd(p, "Winged" ) ) return DRIVE_WINGED;
+ if ( Cmd(p, "Legged" ) ) return DRIVE_LEGGED;
+
+ return DRIVE_OTHER;
+}
+
+// Returns the name of a drive.
+
+const char* GetDrive(DriveType type)
+{
+ if ( type == DRIVE_WHEELED ) return "Wheeled";
+ if ( type == DRIVE_TRACKED ) return "Tracked";
+ if ( type == DRIVE_WINGED ) return "Winged";
+ if ( type == DRIVE_LEGGED ) return "Legged";
+ return "Other";
+}
+
+// Returns the type of tool.
+
+ToolType GetTool(char *line, int rank)
+{
+ char* p;
+
+ p = SearchArg(line, rank);
+ if ( *p == 0 ) return TOOL_OTHER;
+
+ if ( Cmd(p, "Grabber" ) ) return TOOL_GRABBER;
+ if ( Cmd(p, "Sniffer" ) ) return TOOL_SNIFFER;
+ if ( Cmd(p, "Shooter" ) ) return TOOL_SHOOTER;
+ if ( Cmd(p, "OrgaShooter" ) ) return TOOL_ORGASHOOTER;
+
+ return TOOL_OTHER;
+}
+
+// Returns the name of a tool.
+
+const char* GetTool(ToolType type)
+{
+ if ( type == TOOL_GRABBER ) return "Grabber";
+ if ( type == TOOL_SNIFFER ) return "Sniffer";
+ if ( type == TOOL_SHOOTER ) return "Shooter";
+ if ( type == TOOL_ORGASHOOTER ) return "OrgaShooter";
+ return "Other";
+}
+
// Returns an integer.
int OpInt(char *line, const char *op, int def)
@@ -887,6 +943,24 @@ Gfx::CameraType OpCamera(char *line, const char *op)
return GetCamera(line, 0);
}
+// Returns the type of drive.
+
+DriveType OpDrive(char *line, const char *op)
+{
+ line = SearchOp(line, op);
+ if ( *line == 0 ) return DRIVE_OTHER;
+ return GetDrive(line, 0);
+}
+
+// Returns the type of tool.
+
+ToolType OpTool(char *line, const char *op)
+{
+ line = SearchOp(line, op);
+ if ( *line == 0 ) return TOOL_OTHER;
+ return GetTool(line, 0);
+}
+
// Returns the type of a building.
int OpBuild(char *line, const char *op)
diff --git a/src/script/cmdtoken.h b/src/script/cmdtoken.h
index fe831f1..24b592f 100644
--- a/src/script/cmdtoken.h
+++ b/src/script/cmdtoken.h
@@ -45,6 +45,10 @@ extern int GetResearch(char *line, int rank);
extern Gfx::PyroType GetPyro(char *line, int rank);
extern Gfx::CameraType GetCamera(char *line, int rank);
extern const char* GetCamera(Gfx::CameraType type);
+extern DriveType GetDrive(char *line, int rank);
+extern const char* GetDrive(DriveType type);
+extern ToolType GetTool(char *line, int rank);
+extern const char* GetTool(ToolType type);
extern int OpInt(char *line, const char *op, int def);
extern float OpFloat(char *line, const char *op, float def);
@@ -55,6 +59,8 @@ extern Gfx::EngineObjectType OpTypeTerrain(char *line, const char *op, Gfx::Engi
extern int OpResearch(char *line, const char *op);
extern Gfx::PyroType OpPyro(char *line, const char *op);
extern Gfx::CameraType OpCamera(char *line, const char *op);
+extern DriveType OpDrive(char *line, const char *op);
+extern ToolType OpTool(char *line, const char *op);
extern int OpBuild(char *line, const char *op);
extern Math::Vector OpPos(char *line, const char *op);
extern Math::Vector OpDir(char *line, const char *op);