changeset 50:48d4f8e3fce5

Add simple functions for checking if texture name is "valid" (e.g. not empty or "-")
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 26 Sep 2011 04:39:34 +0300
parents cf5f6ef9b713
children a521308b47fb
files src/textures.cc src/textures.h
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/textures.cc	Mon Sep 26 04:39:04 2011 +0300
+++ b/src/textures.cc	Mon Sep 26 04:39:34 2011 +0300
@@ -44,6 +44,17 @@
 #include "wads.h"
 #include "wstructs.h"
 
+/* Rudimentary check if the texture name is "valid"
+ */
+int InvalidTextureName(const char *name)
+{
+    return ((name[0] == '-' && name[1] == 0) || name[0] == 0);
+}
+
+int ValidTextureName(const char *name)
+{
+    return !InvalidTextureName(name);
+}
 
 /*
    display a wall texture ("TEXTURE1" or "TEXTURE2" object)
--- a/src/textures.h	Mon Sep 26 04:39:04 2011 +0300
+++ b/src/textures.h	Mon Sep 26 04:39:34 2011 +0300
@@ -16,5 +16,7 @@
 void ChooseWallTexture(int, int, const char *, int, char **, char *);
 void GetWallTextureSize(i16 *, i16 *, const char *);
 
+int  InvalidTextureName(const char *);
+int  ValidTextureName(const char *);
 
 #endif