Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About SDZD

  • Rank
  1. SDZD

    Struct-based vectors

    Again, this solves my problem. (Wow, this is a fast forum!) Thanks again, ~SDZD
  2. SDZD

    How to be Evil?

    The biggest problem I perceive is that RPGs aren't cut for an eviloverlord scenario. In order to really do that, you'd either have to have some superpower of control a large number of minions. RPGs (or at least CRPGS) are pretty much designed for a small number of units versus armies. However, if it had to be RPG style, I'd probably do it like this: 1) List cults; gangs; weaker, more established villians; anything that can be assimilated. 2) Take control of groups (combat in turn-based style) 3) Use groups to attack potential threats, both competitors and opposition (tactical grid style) 4) Same as 2), but destruction over control (and with minions, simultanious with 3)) 5) Allocate biggest threat (say, annoying rebels building up plot-voucher cannon). Destroy defenders, as in 3). 6) Infiltrate threat's weapon, blow it up (2 and 4 style) 7) Win. All this time, you'll have to fend off assassins and infiltrators (and superheros, if we are using that theme).
  3. SDZD

    Struct-based vectors

    Quote:Original post by Firewalker sorry, didnt see the ending initialize call push_back like this: // Adds a new structure to the array vectorName.push_back( MyStructure( parameter1, ..., parameterN ) ); the MyStructure( parameter1, ..., parameterN ) creates an anonomyous structure and uses the constructor that accepts parameter1 to parameterN arguments. Actually, that's what I've been trying. The code is here: backround.h #ifndef BACKROUND_H #define BACKROUND_H #include "vector.h" class Storage { public: Storage(); void Vec_read(); void Vec_write(int); ~Storage(); private: struct numfreq { int num; int freq; }; vector<numfreq> numstore; }; #endif backround.cpp #include "backround.h" Storage::Storage() { numstore.push_back(numfreq(1, 0)); //vectorName.push_back( MyStructure( parameter1, ..., parameterN ) ); //numstore[0].num = 1; //numstore[0].freq = 0; } Storage::~Storage() { } void Storage::Vec_read() { } void Storage::Vec_write(int number) { vector<numfreq>::iterator search = numstore.begin(); } Whenever I try to compile it, I get 5 C:\Dev-Cpp\backround.cpp numfreq(int, int)' error C:\Dev-Cpp\backround.h:14 candidates are: Storage::numfreq::numfreq() 14 C:\Dev-Cpp\backround.h Storage::numfreq::numfreq(const Storage::numfreq&) I'm using Dev-C++, in case that helps.
  4. SDZD

    Struct-based vectors

    Works perfectly. Thanks.
  5. Hi. I've heard that this is one of the best forums for progamming, so let's give it a go... I've been having some trouble with a probability checker that I'm writing. I'm trying to create a vector that holds a structure (hence the title), but I don't know how to access any of the structures variables. I've tried vector(0).structure.variable1 = x but that doesn't seem to work. How am I supposed to do it? Also, how do I initialize it (say, with pushback()), and include the variables at the same time? Thanks! ~SDZD
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!