Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Josh @ Dreamland

2446
Announcements / Re: R3 isn't dead
« on: December 12, 2009, 03:23:30 PM »
Syntax check button.

Also, R4 will offer much more stable support, as well as new things like DND. It'll be a firmly laid foundation for everything to come. And I've gotten so much better with C++ since the start of this project, believe me, there'll be a lot of that.

I'm sick of showing off my favorite new features at this point, so I'll wait until release day to bring them up again.

2447
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 11, 2009, 04:01:42 PM »
Eh, showborder?GL_LINE_LOOP:GL_QUADS will suffice. Keep in mind var::operator bool() will cover that. And if they're simply passing .5 as a literal, I don't care if it turns out that it doesn't behave exactly like GM; the only reason someone would do that was if they were just trying to find some difference to shove in our noses.

2448
Announcements / Re: R3 isn't dead
« on: December 11, 2009, 03:52:15 PM »
None of my new syntax adaptations will prevent GML from working. In fact, some of R4's changes bring it closer to working like GM, such as var::operator bool(). Serp and I were just discussing a discrepancy where if (.5) is evaluated as true in GM. I'd known this since the start, of course, but only now do I have a method of doing that (Overloading bool before would have conflicted with std::string).

So, yes, the objective is still to allow backwards compatibility with GM.

2449
Announcements / Re: R3 isn't dead
« on: December 10, 2009, 07:29:20 PM »
*shrug*

That was a bit graphic a depiction. But yes, most of R3 is antiquated. That doesn't mean I'm going back on the idea of full GM support, of course, I just can't have ENIGMA be as pathetic as GM.

2450
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 09, 2009, 06:58:43 AM »
You know, I gave it some thought, and I think that although what you're doing wouldn't be good for small peeks into big files, it's best to do what you're doing now. You use a good deal of C methods in it, such as strcmp rather than std::string's assortment of goodies. Is this to save the eight byte prefix? I'm thinking that string::operator== may be faster than strcmp in most cases, at the cost of the eight bytes.

I'd inline swapints, but I think GCC will do that for you (Inline void instead of void).

Overall though, the code is good. You seem to have a good grasp of the language, regardless of how long you've been using it.

When you are done, you can either take a whack at this or I'll do it later, it doesn't matter: I'm thinking that to improve speed for bigger files (at the cost of a deal of memory) you could use std::map either alongside or instead of your linked list, chain. Using it as an alternative will alphabetize everything, which you may not want. Using it alongside will save on lookup (no iterating every chain).
in the class,
map<string,Section*> sections;
typedef map<string,Section*>::iterator sec_it;

Then FindSection will be
{
  sec_it it = sections.find(sectname);
  if (it != sections.end())
    return it->second;
  return NULL;
}

It'd make your life easier, anyway. If you were specifically avoiding map so it wouldn't alphabetize things, the code's basically perfect. (I can't remember if GM does so or not, sadly). One last thing I'd recommend is adding the license at the top. ;)

Oh, and I'm used to working with no comments. Your code was rather clean and easy to navigate.

2451
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 08, 2009, 10:48:49 PM »
Most of the things you can do by loading it into memory can be done with BUFSIZ buffers loaded one at a time, and fseek(), but I'll trust your judgment, especially if the benchmarks are similar.

2452
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 08, 2009, 09:24:06 PM »
Use show_error as GM defines it. I'm not sure how liberally that function is implemented in R3, but it'll be alive in full force for R4. If nothing else, implement it yourself in your code (int show_error(string e,int fatal) { cout << "error: "<<e<<endl; return fatal; }), and I will make sure it doesn't throw a linker error before R4 is released (Or you can, really. I trust you'll know how).

Also, good to know it's GPL.

2453
Tips, Tutorials, Examples / Re: A Few Alternate Functions
« on: December 08, 2009, 09:21:01 PM »
>_<"

What Rusky said.

2454
Announcements / Re: Changes
« on: December 08, 2009, 09:17:00 PM »
No, they're not. A used element is used. Permanently. I can allow for the array to be manually resized by the user. It'll look something like this:

var a;
a[0] = 1; a[1] = 2; a[2] = 3;
//Method 1:
a.resize(2);
//Method 2:
array_resize(a,1);

2455
Announcements / Re: Changes
« on: December 08, 2009, 04:31:13 PM »
Well.

serp--
It isn't how GM works. a would have two elements in GM, (0,hugearray[0]) and (4,4).

2456
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 08, 2009, 04:29:12 PM »
Supposedly. I don't know the particulars.

2457
Tips, Tutorials, Examples / Re: draw_healthbar() function
« on: December 08, 2009, 05:28:30 AM »
Retro:
I think on account of my own forgetfulness, ENIGMA doesn't have any form of working switch(). It replaces them with some functions that I *believe* were never implemented. But if I did implement those three functions, it'd work. I believe GM switch() statements share complexity with a string of if()s, so that's what ENIGMA does. Ideally, I want to optimize the code, only replacing switch with if()s when I can't tell that all case labels and the input are integers.

Revel:
I'd love that. I made some kind of text file implementation that I never documented (in any form, I mean), but I never did do INI. Is your code GPL?

2458
Announcements / Re: Changes
« on: December 08, 2009, 05:14:58 AM »
Bahahahaha.

Either way, that's seven. I don't have a personal vendetta against it. Yet.

Oh, and Luis. Casts are magic. var::var(var) and var::operator= (const var&) can "copy" the entire array in C++. I place copy in quotes because it'll be copy-on-write. If your sole purpose is to read an array passed as a parameter, it'll be done in constant time. Only if you start editing the array will it copy. That means that var can be passed as an array as well as copied. The cost of such an action is efficiency if no intelligence is used. For example:

a = hugearray;
a += 4;

Will function the same in GM and ENIGMA, as far as users can tell. In actuality, the ENIGMA one will be slower unless users say

a = hugearray[0];
a += 4;

Which any respectable GM user would do.
Copying on write makes only the most blatant (and I do mean stupid) instances of GM syntax slow. Even just implicitly passing the first element in an array as an argument won't be any slower, unless they set the argument somewhere in the code (which I believe is regarded as bad practice, anyway). Nothing that can't be fixed with a [ 0], anyway.

2459
Announcements / Re: Changes
« on: December 07, 2009, 08:27:32 PM »
Gimme back my HLP and stop asking for administrative confirmation for each mouse movement. It gripes every time I open Code::Blocks.

I do like the home button, though, which behaves differently on OS X.

2460
Announcements / Re: Changes
« on: December 07, 2009, 08:13:32 PM »
I think Chrome just wants a width-height parameter.

And yeah, in actuality, I can name far worse operating systems. Namely, Vista. But I figured stylistically it'd just be better to call it that and take he heat later.