Main Page   Data Structures   File List   Globals  

output_button.c File Reference

Outputs a button message to the Core module. More...

#include "white_interface.h"
#include "e:\AndrewWorkspace\Stratego\input.h"

Go to the source code of this file.

Functions

void poin_entry_Init ()
 VCC Init function. More...

void poin_entry_Run ()
 VCC Run function. More...


Variables

int player_no


Detailed Description

Outputs a button message to the Core module.

This block receives a player number from the Lobby module at the start of the game. It uses this to create a button message (which contains its player number) whenever it receives a button press message from the process_input block. The button message is then sent to the game core.

In addition, the output_button block is responsible for telling the Core module the player number that has been assigned to it by Lobby module at the start of the game. It does this by sending a button message with the button_no parameter set to 0 to the Core module as soon as it receives the player number from the lobby.

Definition in file output_button.c.


Function Documentation

void poin_entry_Init  
 

VCC Init function.

This function runs when the VCC simulation is first started.

Definition at line 31 of file output_button.c.

00032 {
00033 }

void poin_entry_Run  
 

VCC Run function.

This runs each time a message arrives at the output_move block's player or in port.

Definition at line 36 of file output_button.c.

References player_no.

00037 {
00038   int input;
00039   button output;
00040 
00041   /*  As soon as the player number is received, pass it on to the
00042       Core module in the form of a "button 0" message. */
00043 
00044   if (player_Enabled())
00045   {
00046     player_no = player_Value();
00047     output.player = player_no;
00048     output.button_no = 0;
00049     out_Post(&output);
00050   }
00051 
00052   /* When a button number is received from the process_input
00053      block, send a button message (which incorporates the
00054      player number) to the Core module. */
00055 
00056   if (in_Enabled())
00057   {
00058     input = in_Value();
00059 
00060     output.player = player_no;
00061     output.button_no = input;
00062     out_Post(&output);
00063   }
00064 }


Variable Documentation

int player_no
 

Stores the player number that is supplied by the lobby module at the start of the game.

Definition at line 28 of file output_button.c.

Referenced by poin_entry_Run.


Copyright © 2002 Andrew Bates
Last Updated 03/04/02