User Tag List

Results 1 to 6 of 6

Thread: help with vectors in rSDK

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,838
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    help with vectors in rSDK

    Hey fellas,
    I'm having problems inserting into a vector array in the rSDK.
    Code:
    //Data.h, at the top
    struct VectorStoresThis
    {
    	INT FValue;
    };
    
    #include <vector>
    using namespace std;
    
    typedef struct tagRDATA
    {
    	#include "MagicRDATA.h"
    
    	vector<VectorStoresThis>* pVector;
    } RUNDATA;
    typedef	RUNDATA	* LPRDATA;
    
    //Runtime.cpp under RunHandleObject
    rdPtr->pVector->insert(rdPtr->pVector->FValue, valuetostore);
    I get an error with the Runtime.cpp version:
    [color:#FF0000]error C2039: 'FValue' : is not a member of 'std::vector<_Ty>'[/color]
    If someone could show me the correct way to insert - I've been through some tutorials and they don't seem to apply...
    I've also tried a whole load of syntax combinations.
    Thanks in advance!

  2. #2
    Clicker Multimedia Fusion 2
    Retriever2's Avatar
    Join Date
    Jun 2006
    Location
    United States
    Posts
    502
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: help with vectors in rSDK

    Perhaps the vector method you really want is push_back: http://www.cplusplus.com/reference/stl/vector/push_back/

    rdPtr->pVector->push_back(valuetostore);

    insert() requires messy iterator use and you don't want to be inserting into the middle of a vector anyway (that's what Lists are for).

    For the sake of education and completeness, if you really wanted to insert something at the beginning of the vector, using insert, you would do this:

    rdPtr->pVector->insert(rdPtr->pVector->begin(), valuetostore);

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,838
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Re: help with vectors in rSDK

    Irritatingly, this now produces a different error:
    My code is now
    rdPtr->pVector->push_back(valuetostore);
    and the error is
    error C2664: 'std::vector<_Ty>::push_back' : cannot convert parameter 1 from 'int' to 'const VectorStoresThis &'
    Those things look pretty different ... valuetostore is:
    (roPtr->roHo.hoCreationId << 16) + roPtr->roHo.hoNumber)
    Do I need to do casting or something similar?

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: help with vectors in rSDK

    If you only want to store ints, you should make a vector of ints. Otherwise, because it's a vector of "struct VectorStoresThis", you need to build one of those to give to push_back.

  5. #5
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,838
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Re: help with vectors in rSDK

    Just ints, yep...
    I replaced VectorStoresThis with int and it compiles okay. Thanks Dynasoft
    I'll see if I can work out the rest from here...

  6. #6
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,838
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Re: help with vectors in rSDK

    With some help from Mathias, the extension works okay now
    Thanks for all your help guys!

Similar Threads

  1. Unicode and rSDK
    By Dines in forum Extension Development
    Replies: 4
    Last Post: 18th December 2012, 01:49 PM
  2. Looking for original rSDK
    By LB in forum Extension Development
    Replies: 3
    Last Post: 6th December 2012, 03:33 AM
  3. Physics Question with Vectors
    By Brisingre in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 14th May 2008, 03:36 AM
  4. rSDK
    By James in forum Extension Development
    Replies: 20
    Last Post: 23rd March 2008, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •