Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 142 143 [144] 145 146 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902470 times)

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2145 on: April 12, 2012, 11:56:21 am »

Well, I've been working on a roguelike for the past few weeks. There's this one part of the code, however, that I've run into a spot of trouble with:

http://pastebin.com/4h68vYxV

Lines 6 through 15, especially, seem to be the problem. The Actor* foundPlayer doesn't seem to ever point toward the found player, even after the assignment is made in line 15 (and yes, class Player inherits from Actor and has much of the same interface, so that shouldn't be a problem). That causes the if block on line 26 not to activate at all, since it's still a nullptr. Running it without the null check causes a runtime failure (obviously).

I've no idea why the pointer is failing to point, though (for lack of a better word). It's in scope, it's mutable, it's a valid assignment and everything, at least to me. Could someone help?
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2146 on: April 12, 2012, 05:15:23 pm »

Perhaps it is a const casting problem? Try not using a const iterator?
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2147 on: April 12, 2012, 08:41:30 pm »

Perhaps it is a const casting problem? Try not using a const iterator?

No, it isn't that either. I tried it earlier without the const keyword, and the result was the same. :/

EDIT: Gah, nevermind. I figured it out myself.
« Last Edit: April 12, 2012, 10:30:12 pm by lordnincompoop »
Logged

Mini

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2148 on: April 12, 2012, 10:48:13 pm »

What was the problem?
Logged

Aptus

  • Bay Watcher
  • Indeed ôo
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2149 on: April 13, 2012, 11:46:25 am »

Not exactly programming but closely enough related I would think.

Damn you VHDL, damn you to a magmapipe. Trying to construct a basic 32-bit ALU, part of which is a 16-bit barrelshifter, being forbidden from using 'process' I try to solve it using a basic sequence of 'with select when' using controlbits but for some reason it keeps screaming at me that "0" is not std_logic when I use it in the 'with select when'.

As in... (the part that is giving me errors is marked in red.)

entity barrelshifter is
 port (input: in std_logic_vector(31 downto 0);
        output: out std_logic_vector(31 downto 0);
        shift1, shift2, shift4, shift8, shift16: in std_logic);
end entity barrelshifter;

architecture behavioral of barrelshifter is

signal outputtemp: std_logic_vector(31 downto 0);

begin

with shift1 select
temp <= input when "0",
--shift           when "1";

with shift2 select
...

with shift4 select

etc.

--I left the actual shift out since it is a pretty lenghty piece, basically it uses the temporary vector to add an appropriate amount of 0's and then copies the previous vector to the remaining spaces.

Now this error probably is more the fault of me being a complete nubcake at VHDL but damn if I don't feel better if I blame the language ;)

If anyone has any pointer to what I should do to fix it I will dance a little jig and purr like a kitten.
Logged

AlStar

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2150 on: April 13, 2012, 04:01:21 pm »

Perhaps it is a const casting problem? Try not using a const iterator?

No, it isn't that either. I tried it earlier without the const keyword, and the result was the same. :/

EDIT: Gah, nevermind. I figured it out myself.

No offense to lordnincompoop, but this, right here, is one of my biggest pet-peeves ever.

Someone has a problem and asks about it, but then manages to find the answer... but never says what it is!

I've run into at least a dozen situations where I'll Google some error message, bug or configuration problem I'm having and have exactly this.

Hell, XKCD actually did a comic on it :http://xkcd.com/979/

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2151 on: April 13, 2012, 06:42:45 pm »

Pfff, did the first GoogleCodeJam assignment drunk, and aced it. I am now ranked at 645! Probably the best position I'll ever get :)

Edit: Ohnoes! Rank 477, intoxicated! But now I need sleep.
« Last Edit: April 13, 2012, 07:29:59 pm by Siquo »
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

NobodyPro

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2152 on: April 13, 2012, 07:05:54 pm »


I have a newfound respect for all of you. I've spent a couple of days making the character creation of my game and it's still not done.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2153 on: April 13, 2012, 08:27:24 pm »

Pfff, did the first GoogleCodeJam assignment drunk, and aced it. I am now ranked at 645! Probably the best position I'll ever get :)

Edit: Ohnoes! Rank 477, intoxicated! But now I need sleep.

Rank 456 with 40 points here. I'll be shooting for more points when my brain can function again.

Note to self: Do not try to program after busy days at school.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2154 on: April 14, 2012, 06:06:54 pm »

I hate libtcod so goddamn much.  I don't know if the problem is the files, or Visual Studio, but I can't load all of the dll's necessary.  Specifically, the unmanaged and vs dll's crash the IDE when I try to load them, claiming they're not valid files (for a split second), while the main framework dll loads fine.

I really should just jump into XNA (like I was talking about two months ago), but getting this damn library to work has become a matter of pride.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2155 on: April 14, 2012, 08:41:05 pm »

---

I could probably write this in Verilog HDL in my sleep...I miss my FPGA...  Anyway, the reference manual for VHDL says that std_logic is defined as
Code: [Select]
type std_ulogic is (
'U',
-- Uninitialized
'X',
-- Forcing Unknown
'0',
-- Forcing 0
'1',
-- Forcing 1
'Z'
-- High Impedance
'W'
-- Weak Unknown
'L'
-- Weak 0
'H'
-- Weak 1
'-'
-- Don't care
);

You could try replacing the '0' and '1' in your code with 'L' and 'H'.  Off hand, I don't know the nuances of VHDL.  If that doesn't work, I'll have to actually look into it.  Let me know.

For everyone else's reference, confusingly enough, yes Verilog HDL and VHDL are indeed different languages.

Pfff, did the first GoogleCodeJam assignment drunk, and aced it. I am now ranked at 645! Probably the best position I'll ever get :)

Edit: Ohnoes! Rank 477, intoxicated! But now I need sleep.

Come on man, you know darn well that programmers do their absolute best work while drunk.  If only employers believed us...

---
I have a newfound respect for all of you. I've spent a couple of days making the character creation of my game and it's still not done.

Welcome to the wonderful world of programming.  Care to ask any questions?

I hate libtcod so goddamn much.  I don't know if the problem is the files, or Visual Studio, but I can't load all of the dll's necessary.  Specifically, the unmanaged and vs dll's crash the IDE when I try to load them, claiming they're not valid files (for a split second), while the main framework dll loads fine.

I really should just jump into XNA (like I was talking about two months ago), but getting this damn library to work has become a matter of pride.

This is why I started with ncurses and began implementing my own roguelike library.  I've been moving faster implementing my own library from scratch than any of you have trying to get libcodt working.  Speaking of which, wasn't Max White threatening to do exactly that for a couple of months?
Logged

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2156 on: April 14, 2012, 09:03:17 pm »

I hate libtcod so goddamn much.  I don't know if the problem is the files, or Visual Studio, but I can't load all of the dll's necessary.  Specifically, the unmanaged and vs dll's crash the IDE when I try to load them, claiming they're not valid files (for a split second), while the main framework dll loads fine.

I really should just jump into XNA (like I was talking about two months ago), but getting this damn library to work has become a matter of pride.

This is why I started with ncurses and began implementing my own roguelike library.  I've been moving faster implementing my own library from scratch than any of you have trying to get libcodt working.  Speaking of which, wasn't Max White threatening to do exactly that for a couple of months?

If I knew how to make graphic elements display in a C# window I'd be all over doing something like that myself.  I suppose I should read up on WPF or something, but I honestly don't even know where to start is putting stuff on the screen that isn't a console.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

Aqizzar

  • Bay Watcher
  • There is no 'U'.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2157 on: April 14, 2012, 11:39:01 pm »

Well, looking on the Libtcod Forum, apparently the developer is aware that Libtcod isn't totally recognized by 64-bit, making it virtually impossible to use, or something.  And he has no plans to do anything about it.

The stupid thing is, I know Libtcod does work with Visual Studio 2010 in Windows 7.  I can load that example game Max White made a couple months ago, and it runs.  I just can't figure out what it's doing that I'm not, so that the initializer doesn't throw a completely unhelpful exception about "libtcodPINVOKE".  I'm obviously not the only person on the Internet having this issue, but I haven't seen the same solution recommended twice, and none of the ones I've been able to try have worked.
Logged
And here is where my beef pops up like a looming awkward boner.
Please amplify your relaxed states.
Quote from: PTTG??
The ancients built these quote pyramids to forever store vast quantities of rage.

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2158 on: April 15, 2012, 12:33:10 am »

I recently made most of a roguelike engine using NCursesSharp and C#. It only supported 8 colors, and it took me a while to figure out I had to put input on another thread, but it worked. I haven't used or even looked at libcotd, so apparently I saved myself nightmares of trouble by doing it all myself.
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2159 on: April 15, 2012, 01:14:11 am »

If I knew how to make graphic elements display in a C# window I'd be all over doing something like that myself.  I suppose I should read up on WPF or something, but I honestly don't even know where to start is putting stuff on the screen that isn't a console.

Now you see, I would take that as a challenge to figure out how to do it.  I might let a mountain things get in my way, but I sure as heck won't let any one issue, no matter what it is, stop me.

Well, looking on the Libtcod Forum, apparently the developer is aware that Libtcod isn't totally recognized by 64-bit, making it virtually impossible to use, or something.  And he has no plans to do anything about it.

The stupid thing is, I know Libtcod does work with Visual Studio 2010 in Windows 7.  I can load that example game Max White made a couple months ago, and it runs.  I just can't figure out what it's doing that I'm not, so that the initializer doesn't throw a completely unhelpful exception about "libtcodPINVOKE".  I'm obviously not the only person on the Internet having this issue, but I haven't seen the same solution recommended twice, and none of the ones I've been able to try have worked.

Is he using the same version of libtcod as you?  Or is he linking something you aren't?  Look for stupid things like that.  If you still can't figure it out, I'll boot into Windows <shudder> and take a look at it.

I recently made most of a roguelike engine using NCursesSharp and C#. It only supported 8 colors, and it took me a while to figure out I had to put input on another thread, but it worked. I haven't used or even looked at libcotd, so apparently I saved myself nightmares of trouble by doing it all myself.

You can't be serious...there's a system for using ncurses with C#?  C# is a Windows exclusive language, ncurses is designed to run on *nix systems like OSX and linux.  It would make far more sense for C# to use pdcurses.  Anyway, care to post it for us to see?
Logged
Pages: 1 ... 142 143 [144] 145 146 ... 796