summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-02-04 00:49:50 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-02-07 12:54:23 -0800
commitc67c2b7435a13d7ce17b2075e22dc5c6036f702a (patch)
treeb84b7b205a361b39d65944a9edb2a353356a9ac9 /src/common
parentb3a0b3e7c94bce46bc0654528df0748cf0c2a6ac (diff)
downloadtmwa-c67c2b7435a13d7ce17b2075e22dc5c6036f702a.tar.gz
tmwa-c67c2b7435a13d7ce17b2075e22dc5c6036f702a.tar.bz2
tmwa-c67c2b7435a13d7ce17b2075e22dc5c6036f702a.tar.xz
tmwa-c67c2b7435a13d7ce17b2075e22dc5c6036f702a.zip
Remove some more Skill-related stuff
Diffstat (limited to 'src/common')
-rw-r--r--src/common/extract.hpp2
-rw-r--r--src/common/nullpo.cpp1
-rw-r--r--src/common/nullpo.hpp19
-rw-r--r--src/common/timer.cpp2
-rw-r--r--src/common/timer.hpp1
5 files changed, 13 insertions, 12 deletions
diff --git a/src/common/extract.hpp b/src/common/extract.hpp
index c60ce2a..3198d5d 100644
--- a/src/common/extract.hpp
+++ b/src/common/extract.hpp
@@ -67,7 +67,7 @@ bool extract(const_string str, T *iv)
// defer to integer version
if (!extract(str, &v))
return false;
- // TODO check bounds ...
+ // TODO check bounds using enum min/max as in SSCANF
*iv = static_cast<T>(v);
return true;
}
diff --git a/src/common/nullpo.cpp b/src/common/nullpo.cpp
index d7d489c..423ed8c 100644
--- a/src/common/nullpo.cpp
+++ b/src/common/nullpo.cpp
@@ -5,6 +5,7 @@
#include "../poison.hpp"
/// Actual output function
+static
void nullpo_info(const char *file, int line, const char *func)
{
if (!file)
diff --git a/src/common/nullpo.hpp b/src/common/nullpo.hpp
index ad1084a..2d8644f 100644
--- a/src/common/nullpo.hpp
+++ b/src/common/nullpo.hpp
@@ -1,22 +1,22 @@
/// return wrappers for unexpected NULL pointers
#ifndef NULLPO_HPP
#define NULLPO_HPP
-/// Comment this out to live dangerously
-# define NULLPO_CHECK
+/// Uncomment this to live dangerously
+/// (really exist to detect mostly-unused variables)
+//# define BUG_FREE
/// All functions print to standard error (was: standard output)
/// nullpo_ret(cond) - return 0 if given pointer is NULL
/// nullpo_retv(cond) - just return (function returns void)
/// nullpo_retr(rv, cond) - return given value instead
-# ifdef NULLPO_CHECK
-# define NLP_MARK __FILE__, __LINE__, __func__
+# ifndef BUG_FREE
# define nullpo_retr(ret, t) \
- if (nullpo_chk(NLP_MARK, t)) \
+ if (nullpo_chk(__FILE__, __LINE__, __func__, t)) \
return ret;
-# else // NULLPO_CHECK
-# define nullpo_retr(ret, t) t;
-# endif // NULLPO_CHECK
+# else // BUG_FREE
+# define nullpo_retr(ret, t) /*t*/
+# endif // BUG_FREE
# define nullpo_ret(t) nullpo_retr(0, t)
# define nullpo_retv(t) nullpo_retr(, t)
@@ -27,7 +27,4 @@
bool nullpo_chk(const char *file, int line, const char *func,
const void *target);
-/// Used only by map/battle.c
-void nullpo_info(const char *file, int line, const char *func);
-
#endif // NULLPO_HPP
diff --git a/src/common/timer.cpp b/src/common/timer.cpp
index 65f04e0..92d284c 100644
--- a/src/common/timer.cpp
+++ b/src/common/timer.cpp
@@ -185,11 +185,13 @@ void delete_timer(timer_id id, timer_func func)
FPRINTF(stderr, "delete_timer error : no such timer %d\n", id);
abort();
}
+#ifndef delete_timer
if (timer_data[id].func != func)
{
FPRINTF(stderr, "Timer mismatch\n");
abort();
}
+#endif
// "to let them disappear" - is this just in case?
timer_data[id].func = NULL;
timer_data[id].type = TIMER_ONCE_AUTODEL;
diff --git a/src/common/timer.hpp b/src/common/timer.hpp
index db4dedd..b00d48d 100644
--- a/src/common/timer.hpp
+++ b/src/common/timer.hpp
@@ -52,6 +52,7 @@ tick_t gettick(void);
timer_id add_timer(tick_t, timer_func, custom_id_t, custom_data_t);
timer_id add_timer_interval(tick_t, timer_func, custom_id_t, custom_data_t, interval_t);
+//#define delete_timer(tid, func) delete_timer(tid)
void delete_timer(timer_id, timer_func);
tick_t addtick_timer(timer_id, interval_t);