made spawn_items more consistent and documented it

This commit is contained in:
Andrei "Akari" Alexeyev 2017-03-25 08:46:20 +02:00
parent 03940475e9
commit 31bbef7aae
2 changed files with 7 additions and 7 deletions

View file

@ -158,13 +158,9 @@ void spawn_item(complex pos, ItemType type) {
create_item(pos, 5*cexp(I*tsrand_a(0)/afrand(1)*M_PI*2), type);
}
void spawn_items(complex pos, ItemType first_type, int first_num, ...) {
for(int i = 0; i < first_num; ++i) {
spawn_item(pos, first_type);
}
void spawn_items(complex pos, ...) {
va_list args;
va_start(args, first_num);
va_start(args, pos);
ItemType type;
while(type = va_arg(args, ItemType)) {

View file

@ -48,7 +48,11 @@ int collision_item(Item *p);
void process_items(void);
void spawn_item(complex pos, ItemType type);
void spawn_items(complex pos, ItemType first_type, int first_num, ...) __attribute__((sentinel));
// The varargs are: ItemType type1, int num1, ItemType type2, int num2, ..., NULL
// e.g.: Point 10, Power 3, LifeFrag 2, Bomb 1, NULL
// WARNING: if you pass a float or double as the amount, it will not work! You must explicitly cast it to an int.
void spawn_items(complex pos, ...) __attribute__((sentinel));
void items_preload(void);