/**
 * Checks if a the tag key was pressed and if the current player is a guard.
 * If a player was tagged, the tag data is sent to the server.
 *
 * @param[in,out] world      		A pointer to the world structure.
 * @param[in]     entity   			The player entity number. 
 *
 * @designer 
 * @author   
 */
bool tag_player(World* world, unsigned int entity) {
	if (world->collision[entity].type == COLLISION_GUARD && world->command[entity].commands[C_ACTION]) {
		unsigned int* collision_list = NULL;
		unsigned int num_collisions;
		if (spacebar_collision(world, entity, &collision_list, &num_collisions)) {
			unsigned int i;
			for (i = 0; i < num_collisions; i++) {
				if (world->collision[collision_list[i]].type == COLLISION_HACKER) {
					printf("tagged\n");
					send_tag(world, send_router_fd[WRITE], world->player[collision_list[i]].playerNo);
				}
			}
			cleanup_spacebar_collision(&collision_list);
		}
	}
	return false;
}
Esempio n. 2
0
File: memsup.c Progetto: 1153/otp
static void 
extended_show_mem(void){
    memory_ext me;
    unsigned long ps;
    
    get_extended_mem(&me);
    ps = me.pagesize;
   
    if (me.flag & F_MEM_TOTAL)  { send_tag(MEM_TOTAL);        send(me.total, ps);      }
    if (me.flag & F_MEM_FREE)   { send_tag(MEM_FREE);         send(me.free, ps);       }

    /* extensions */
    if (me.flag & F_MEM_BUFFERS){ send_tag(MEM_BUFFERS);      send(me.buffered, ps);   }
    if (me.flag & F_MEM_CACHED) { send_tag(MEM_CACHED);       send(me.cached, ps);     }
    if (me.flag & F_MEM_SHARED) { send_tag(MEM_SHARED);       send(me.shared, ps);     }
    
    /* swap */
    if (me.flag & F_SWAP_TOTAL) { send_tag(SWAP_TOTAL);       send(me.total_swap, ps); }
    if (me.flag & F_SWAP_FREE)  { send_tag(SWAP_FREE);        send(me.free_swap, ps);  }
    
    /* total is system total*/
    if (me.flag & F_MEM_TOTAL)  { send_tag(MEM_SYSTEM_TOTAL); send(me.total, ps);     }
    send_tag(SHOW_SYSTEM_MEM_END);
}