Example #1
0
 relation& get_relation(const std::string& name,bool create=false)
 {
   relation_map::iterator it(relations.find(name));
   if(it==relations.end())
     {
       if(create)
         return add_relation(name);
       else
         throw relation_not_found();
     }
   else
     return *(it->second);
 }
Example #2
0
void setup()
{
  set_adj("shiny", "metal");
  set_id("tankard");
  set_long( "It is a tankard made from shiny metal." );
#ifdef USE_SIZE
  set_size( 4 );
#endif
#ifdef USE_MASS
  set_mass( 4 );
#endif
  add_relation("in", 8);
  set_default_relation("in");
}
Example #3
0
void setup() {
  add_relation("in");
  set_default_relation("in");
  set_gettable("It is securely anchored.\n");
  set_id("mailbox", "box");
  set_adj("small");
  set_in_room_desc("There is a small mailbox here.");
  set_max_capacity(SMALL);
#ifdef USE_SIZE
  set_size(MEDIUM);
#endif
#ifdef USE_MASS
  set_mass(MEDIUM);
#endif
  set_objects( ([
		 "leaflet" : 1
  ]) );
}
Example #4
0
File: horse.c Project: Lundex/lima
void setup()
{
set_relations("on");
    set_adj("ugly");
    set_id("horse");
    set_long("Damn, the horse is ugly!");
    add_relation("on",VERY_LARGE*2);
    set_default_relation("on");
    // So people will see: Sitting on the horse you see Rust...
//  set_primary_verb("sitting");
    set_in_room_desc("There is an ugly horse here.");
    set_get_on_msg("$N $vget onto the ugly horse.\n");
    set_get_off_msg("$N $vdismount from the ugly horse.\n");

// We could opt for simple messages, and uncomment these
// 2 lines, but we can also go for more complex msgs (see below).
    set_arrival_msg("$N $vtrot off.\n");
    set_departure_msg("$N $vtrot in.\n");
    add_method("mount", this_object());
    add_method("dismount", (: environment(this_object()) :) );
}
Example #5
0
/*
 * setup to exactly one endpoint
 * if it fails, the calling endpoint is released.
 * if other outgoing endpoints already exists, they are release as well.
 * note: if this functions fails, it will destroy its own join object!
 */
int JoinPBX::out_setup(unsigned int epoint_id, int message_type, union parameter *param, char *newnumber, char *newkeypad)
{
	struct join_relation *relation;
	struct lcr_msg *message;
	class Endpoint *epoint;

	PDEBUG(DEBUG_JOIN, "no endpoint found, so we will create an endpoint and send the setup message we have.\n");
	/* create a new relation */
	if (!(relation=add_relation()))
		FATAL("No memory for relation.\n");
	relation->type = RELATION_TYPE_SETUP;
	relation->channel_state = 0; /* audio is assumed on a new join */
	relation->tx_state = NOTIFY_STATE_ACTIVE; /* new joins always assumed to be active */
	relation->rx_state = NOTIFY_STATE_ACTIVE; /* new joins always assumed to be active */
	/* create a new endpoint */
	epoint = new Endpoint(0, j_serial);
	if (!epoint)
		FATAL("No memory for Endpoint instance\n");
	epoint->ep_app = new_endpointapp(epoint, 1, EAPP_TYPE_PBX); // outgoing
	relation->epoint_id = epoint->ep_serial;
	/* send setup message to new endpoint */
//printf("JOLLY DEBUG: %d\n",join_countrelations(j_serial));
//i			if (options.deb & DEBUG_JOIN)
//				joinpbx_debug(join, "Join::message_epoint");
	message = message_create(j_serial, relation->epoint_id, JOIN_TO_EPOINT, message_type);
	memcpy(&message->param, param, sizeof(union parameter));
	if (newnumber)
		SCPY(message->param.setup.dialinginfo.id, newnumber);
	else
		message->param.setup.dialinginfo.id[0] = '\0';
	if (newkeypad)
		SCPY(message->param.setup.dialinginfo.keypad, newkeypad);
	else
		message->param.setup.dialinginfo.keypad[0] = '\0';
	PDEBUG(DEBUG_JOIN, "setup message sent to ep %d with number='%s' keypad='%s'.\n", relation->epoint_id, message->param.setup.dialinginfo.id, message->param.setup.dialinginfo.keypad);
	message_put(message);
	return(0);
}
Example #6
0
//---------------------------------------------------------------------------------------
ImoObj* Linker::add_child_to_model(ImoObj* pParent, ImoObj* pChild, int ldpChildType)
{
    //If the object (or its content, for DTOs) is added to the model it must return NULL.
    //Othewise, it must return the received object. This behaviour is necessary to
    //simplify unit tests of LdpAnalyser

    m_ldpChildType = ldpChildType;
    m_pParent = pParent;

    switch(pChild->get_obj_type())
    {
        case k_imo_bezier_info:
            return add_bezier(static_cast<ImoBezierInfo*>(pChild));

        case k_imo_content:
            return add_content(static_cast<ImoContent*>(pChild));

        case k_imo_cursor_info:
            return add_cursor(static_cast<ImoCursorInfo*>(pChild));

        case k_imo_font_style_dto:
            return add_font_style(static_cast<ImoFontStyleDto*>(pChild));

        case k_imo_instrument:
            return add_instrument(static_cast<ImoInstrument*>(pChild));

        case k_imo_instr_group:
            return add_instruments_group(static_cast<ImoInstrGroup*>(pChild));

        case k_imo_listitem:
            return add_listitem(static_cast<ImoListItem*>(pChild));

        case k_imo_midi_info:
            return add_midi_info(static_cast<ImoMidiInfo*>(pChild));

        case k_imo_music_data:
            return add_child(k_imo_instrument, pChild);

        case k_imo_option:
            return add_option(static_cast<ImoOptionInfo*>(pChild));

        case k_imo_page_info:
            return add_page_info(static_cast<ImoPageInfo*>(pChild));

        case k_imo_param_info:
            return add_param_info(static_cast<ImoParamInfo*>(pChild));

        case k_imo_score_text:
            return add_text(static_cast<ImoScoreText*>(pChild));

        case k_imo_score_title:
            return add_title(static_cast<ImoScoreTitle*>(pChild));

        case k_imo_staff_info:
            return add_staff_info(static_cast<ImoStaffInfo*>(pChild));

        case k_imo_styles:
            return add_child(k_imo_document, pChild);

        case k_imo_system_info:
            return add_system_info(static_cast<ImoSystemInfo*>(pChild));

        case k_imo_style:
            return add_style(static_cast<ImoStyle*>(pChild));

        case k_imo_table_row:
        {
            if (m_pParent)
            {
                if (m_pParent->is_table_head())
                    return add_child(k_imo_table_head, pChild);
                else if (m_pParent->is_table_body())
                    return add_child(k_imo_table_body, pChild);
                else
                    return pChild;
            }
            else
                return pChild;
        }

        case k_imo_table_head:
        case k_imo_table_body:
        {
            if (m_pParent && m_pParent->is_table())
                return add_child(k_imo_table, pChild);
            else
                return pChild;
        }

        default:
            if (pChild->is_block_level_obj())
                return add_block_level_item(static_cast<ImoBlockLevelObj*>(pChild));
            else if (pChild->is_inline_level_obj())
                return add_inline_level_item(static_cast<ImoInlineLevelObj*>(pChild));
            else if (pChild->is_staffobj())
                return add_staffobj(static_cast<ImoStaffObj*>(pChild));
            else if (pChild->is_relobj())
                return add_relation(static_cast<ImoRelObj*>(pChild));
            else if (pChild->is_auxobj())
                return add_attachment(static_cast<ImoAuxObj*>(pChild));
            else
                return pChild;
    }
}