# HG changeset patch # User Matti Hamalainen # Date 1317001174 -10800 # Node ID 48d4f8e3fce54630c9793675bf61df01e9d6e4e5 # Parent cf5f6ef9b713f0079b709e81770445c83893d4da Add simple functions for checking if texture name is "valid" (e.g. not empty or "-") diff -r cf5f6ef9b713 -r 48d4f8e3fce5 src/textures.cc --- 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) diff -r cf5f6ef9b713 -r 48d4f8e3fce5 src/textures.h --- 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