summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2014-07-13 16:55:07 +0200
committer/dev/humancontroller <devhc@example.com>2017-03-09 13:51:11 +0100
commit781bc91fa496f19576568cd1218b54127d8cfba7 (patch)
tree5a663c9ed40115e3a28805788ee34deb37e99a1f
parenta2b4c1c22e6d86a517f6c82af0a524816bc3871a (diff)
add a string duplicating function into the game module
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_utils.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 17492166..047aa4c1 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -829,6 +829,7 @@ gentity_t *G_TempEntity( vec3_t origin, int event );
void G_Sound( gentity_t *ent, int channel, int soundIndex );
void G_FreeEntity( gentity_t *e );
qboolean G_EntitiesFree( void );
+char *G_CopyString( const char *str );
void G_TouchTriggers( gentity_t *ent );
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 3a4bd3f4..c11df5ba 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -479,6 +479,15 @@ qboolean G_EntitiesFree( void )
}
+char *G_CopyString( const char *str )
+{
+ size_t size = strlen( str ) + 1;
+ char *cp = BG_Alloc( size );
+ memcpy( cp, str, size );
+ return cp;
+}
+
+
/*
=================
G_FreeEntity