Jump to content

  • Log In with Google      Sign In   
  • Create Account

fastcall22

Member Since 04 Feb 2008
Offline Last Active Today, 02:25 PM

#5261229 Can a full program be stored in a photo image

Posted by fastcall22 on 09 November 2015 - 04:18 PM

Yes.
No. No. No.
...
No.




#5261001 Connecting to SQL Server

Posted by fastcall22 on 08 November 2015 - 08:17 AM

If I recall correctly, you will need to create a login and a user.


#5260151 C++ enum class error

Posted by fastcall22 on 02 November 2015 - 11:17 AM

My code. *ignore the content*


*** TRIGGERED ***


Nah, your problem most likely resides outside of the file. Check the actual file and line where the first error is occurring. If the code looks okay, then it's probably a missing semicolon from the file that included that one. Check there next.


#5260048 How do I re-size a binary file?

Posted by fastcall22 on 01 November 2015 - 07:27 PM

Haven't you heard? It has a 12gb RAM requirement. Clearly OP is trying to fix that.

/troll


See. This is why you don't load the entire thing into memory first, just do it in chunks:
 
max_block_size = 8*1024*1024; // 8 MiB
buffer = alloc max_block_size
in_data = ...
target_pos = ...
target_next_pos = ...

# copy left side
remaining = target_pos
while (block_sz = (min remaining, max_block_size)) > 0:
  read in_file, buffer, block_sz
  write out_file, buffer, block_sz
  remaining -= block_sz

# insert payload
write out_file, in_data, (sizeof in_data)

# (write additional padding here)

# copy right side
in_file.read_pos = target_next_pos
while (block_sz = read in_file, buffer, max_block_size) > 0:
  write out_file, buffer, block_sz
See? Ansd yoou;re done.

EDIT:
IF you don't have enough ram, then perhaps you should download more ram instead.


#5259905 bmp Loader class

Posted by fastcall22 on 31 October 2015 - 12:49 PM

Writing an image loader can be a fun exercise and creating a custom format isn't too difficult: Width, height, bbp, compression options, an optional palette, and then the image payload, uncompressed or compressed with zlib. Just be mindful of any padding a compiler might add to your structs, if you are to directly serialize a struct to and from a file like Alundra's example.

If you're looking to get something working quickly, then you should use consider using any widely availble libraries. Microsoft has the Windows Imaging Component service, which allows you to use any of the codecs provided by the operating system: GIF, JPEG, PNG, BMP, and et. al. For cross platform options, there is stb_image. Most cross platform game tools will also include some image loading utilities as well.


#5259456 Jim. Adams's book

Posted by fastcall22 on 28 October 2015 - 01:32 PM

Wow. 2002.


No wonder he's having so many problems.


#5258411 Problem with save mechanisms

Posted by fastcall22 on 21 October 2015 - 02:05 PM

You'll need to separate your fields with whitespace. Otherwise, there would be no distinguishing between {1, 2, and 3} and {123, uninitialized, uninitialized}:
 
fout	<<characterclass << ' '
	<<xp << ' '
	<<lvl << ' '
	<<gender << ' '
	<<hpmax << ' '
	<<hp << ' '
	<<charactername << ' '
	<<mpmax << ' '
	<<mp << ' '
	<<ad << ' '
	<<cs << ' '
;
EDIT;
Ninja'd


#5258031 This should be simple for someone to help me with (ADDING SOUND IN UNITY)

Posted by fastcall22 on 19 October 2015 - 08:52 PM

if (IsRestarting == false);


And you have a stray semi-colon.


dry.png


#5257980 Does calling ~myclass() (destructor) deletes the object?

Posted by fastcall22 on 19 October 2015 - 02:50 PM

pdata = in.pdata; //shared data
texture = in.texture; //opengl shared data


This is bad, because now two TGLTexture objects technically own "pdata" and "texture". Which TGLTexture object is supposed to free/release them?


#5257968 Does calling ~myclass() (destructor) deletes the object?

Posted by fastcall22 on 19 October 2015 - 02:16 PM

... Wiredcat,


This is why you do proper RAII following rule-of-3 and using std::vector. If you do these things, you wouldn't need to worry about any of this nonsense.


Stop writing C and start using C++.


#5257518 JS Dice Roller

Posted by fastcall22 on 16 October 2015 - 10:50 AM

this.roll = function(amount, sides, mod = 0) {
    var min = amount;
    var max = sides * amount;
    var value = 0;

    for (i = 0; i <= amount; i++)
        value = value + (Math.floor(Math.random() * (max - min + 1)) + min);
}


This doesn't make any sense. To roll five 6-sided dice, you sum 5 numbers between 5 and 31? It should sum 5 numbers between 1 and 6. Therefore, 'min' should always be 1, and 'max' should always be 6:
 
this.roll = function(amount, sides, mod) {
	var sum = 0;
	for ( var idx = 0; idx < amount; ++idx )
		sum += Math.floor(Math.random()*sides) + 1;

	return sum + (mod||0);
};

And here's a test:
> Array.apply(null,{length: 100}).map(function(){return roll(2,6);})

[7, 6, 5, 5, 10, 8, 9, 6, 3, 8, 3, 11, 3, 6, 5, 10, 8, 10, 9, 5, 9, 7, 7, 7, 4, 7, 6, 6, 5, 8, 2, 6, 2, 7, 5, 8, 10, 10, 4, 9, 8, 7, 4, 4, 5, 9, 9, 10, 5, 6, 5, 7, 8, 11, 7, 10, 10, 12, 6, 6, 8, 4, 8, 8, 8, 9, 7, 5, 7, 9, 5, 7, 11, 8, 9, 3, 11, 9, 9, 11, 5, 8, 7, 6, 4, 7, 11, 3, 9, 3, 9, 8, 4, 8, 7, 9, 3, 6, 6, 5]

Additionally Javascript does not have default parameters. You'll either need to do this by hand, or since undefined is falsey, you can use the logical-or operator to select a zero instead:
var f = function(a,b,c) {
	if ( c === undefined )
		c = 0;
	// or:
	c = c || 0;
}



#5257402 Why didn't somebody tell me?

Posted by fastcall22 on 15 October 2015 - 04:37 PM

will search for text in all files recursively in a directory


Yes, and regular expression matching and replacing, too:

Replace: "[ \t]+$"
With: ""
Where: Project, *.*


To eliminate all trailing whitespace because git is extra picky about it.


#5257281 fatal error C1083 How do I solve?

Posted by fastcall22 on 14 October 2015 - 09:40 PM

C1083.


#5257274 Why are voxels more efficient than polygons?

Posted by fastcall22 on 14 October 2015 - 09:09 PM

It seems as if every single statement he makes is just pulled out of his arse?

It reminds me of those "infinite detail" demos from years back.

Yep, it looks like it's Unlimited Detail repackaged to lure investors.

Here's an old thread about it:
http://www.gamedev.net/topic/599083-unlimited-detail-technology/


#5256440 Do you use friend to avoid security problems ?

Posted by fastcall22 on 09 October 2015 - 04:01 PM

Do you use friend to avoid security problems of public functions ?

There isn't any inherit security problems with the use of public functions...

The friend keywords helps enforce class invariants.




PARTNERS