Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8290 for code/branches/portals


Ignore:
Timestamp:
Apr 21, 2011, 10:48:55 PM (14 years ago)
Author:
dafrick
Message:

Moving the things done with the eventTemplate into the PortalEndPoint class.

Location:
code/branches/portals
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/portals/data/levels/portals.oxw

    r8278 r8290  
    2626  >
    2727
    28     <Template name=portalEventTemplate>
    29         <PortalEndPoint>
    30             <events>
    31                 <execute>
    32                     <EventListener event="portal" />
    33                 </execute>
    34             </events>
    35         </PortalEndPoint>
    36     </Template>
    37 
    3828    <Template name=portalDefault>
    3929        <PortalEndPoint>
     
    4535
    4636    <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="portalDefault" eventTemplate="portalEventTemplate" />
    47     <PortalEndPoint position="-400,0,0" id="2" distance="40" lookat="0,100,0" target="MobileEntity" design="portalDefault" eventTemplate="portalEventTemplate" />
     37    <PortalEndPoint position="-400,0,0" id="2" distance="40" lookat="0,100,0" target="MobileEntity" design="portalDefault" />
    4838    <PortalLink fromID="1" toID="2" />
    4939    <PortalLink fromID="2" toID="1" />
  • code/branches/portals/src/modules/portals/PortalEndPoint.cc

    r8278 r8290  
    99{
    1010    CreateFactory(PortalEndPoint);
     11   
     12    /*static*/ const std::string PortalEndPoint::EVENTFUNCTIONNAME = "execute";
    1113
    1214    std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
     
    3133        XMLPortParam(PortalEndPoint, "design", setTemplate, getTemplate, xmlelement, mode);
    3234        XMLPortParamExtern(PortalEndPoint, DistanceMultiTrigger, this->trigger_, "distance", setDistance, getDistance, xmlelement, mode);
    33         XMLPortParamLoadOnly(PortalEndPoint, "eventTemplate", setEventTemplate, xmlelement, mode);
    3435        XMLPortParamLoadOnly(PortalEndPoint, "target", setTargets, xmlelement, mode).defaultValues("Pawn");
     36       
     37        // Add the DistanceMultiTrigger as event source.
     38        this->addEventSource(this->trigger_, EVENTFUNCTIONNAME);
    3539       
    3640        if(mode == XMLPort::LoadObject)
     
    4448        SUPER(PortalEndPoint, XMLEventPort, xmlelement, mode);
    4549       
    46         XMLPortEventSink(PortalEndPoint, BaseObject, "execute", execute, xmlelement, mode);
     50        XMLPortEventSink(PortalEndPoint, BaseObject, EVENTFUNCTIONNAME, execute, xmlelement, mode);
    4751    }
    4852
  • code/branches/portals/src/modules/portals/PortalEndPoint.h

    r8243 r8290  
    4949            void jumpOut(MobileEntity * entity);
    5050        protected:
     51           
    5152        private:
     53            static const std::string EVENTFUNCTIONNAME;
     54           
    5255            unsigned int id_;
    5356            DistanceMultiTrigger * trigger_;
    5457            std::string templateName_;
    55             void setEventTemplate(const std::string & temp)
    56             {
    57                 this->addTemplate(temp);
    58             }
     58
    5959            std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
    6060    };
Note: See TracChangeset for help on using the changeset viewer.