diff options
author | Tim Angus <tim@ngus.net> | 2001-12-18 00:56:29 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-12-18 00:56:29 +0000 |
commit | 9e0d783f4c9419d1dbb0229518102391c5e8bf21 (patch) | |
tree | 6b130480b32eaa8b180334bf1bf264a0b712c3ff /src/game/g_spawn.c | |
parent | 3e746cde9f3bed3750ed86b53999478236a58f60 (diff) |
Got rid of bg_itemlist buildables. Refactored buildable spawning
Diffstat (limited to 'src/game/g_spawn.c')
-rw-r--r-- | src/game/g_spawn.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 653f06de..adb90db9 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -292,36 +292,39 @@ Finds the spawn function for the entity and calls it, returning qfalse if not found =============== */ -qboolean G_CallSpawn( gentity_t *ent ) { - spawn_t *s; - gitem_t *item; +qboolean G_CallSpawn( gentity_t *ent ) +{ + spawn_t *s; + gitem_t *item; + buildable_t buildable; if ( !ent->classname ) { G_Printf ("G_CallSpawn: NULL classname\n"); return qfalse; } - // check item spawn functions - for ( item=bg_itemlist+1 ; item->classname ; item++ ) { - if ( !strcmp(item->classname, ent->classname) ) { - //TA: don't allow items to spawn (atleast for the time being - might need to later?) - G_SpawnItem( ent, item ); - return qtrue; - //return qfalse; - } + //check buildable spawn functions + if( ( buildable = BG_FindBuildNumForEntityName( ent->classname ) ) != BA_NONE ) + { + G_SpawnBuildable( ent, buildable ); + return qtrue; } // check normal spawn functions - for ( s=spawns ; s->name ; s++ ) { - if ( !strcmp(s->name, ent->classname) ) { - if( G_ItemDisabled(item) ) + for( s = spawns; s->name; s++ ) + { + if( !strcmp( s->name, ent->classname ) ) + { + if( G_ItemDisabled( item ) ) return qfalse; + // found it - s->spawn(ent); + s->spawn( ent ); return qtrue; } } - G_Printf ("%s doesn't have a spawn function\n", ent->classname); + + G_Printf( "%s doesn't have a spawn function\n", ent->classname ); return qfalse; } |