• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 18:03
CEST 00:03
KST 07:03
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro8 Preview Pt1: Inheritors6[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists17[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10
Community News
2026 GSL Season 1 Qualifiers19Maestros of the Game 2 announced92026 GSL Tour plans announced15Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid25
StarCraft 2
General
Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid Maestros of the Game 2 announced 2026 GSL Tour plans announced Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament 2026 GSL Season 1 Qualifiers INu's Battles#14 <BO.9 2Matches> GSL CK: More events planned pending crowdfunding RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 523 Firewall Mutation # 522 Flip My Base The PondCast: SC2 News & Results Mutation # 521 Memorable Boss
Brood War
General
[ASL21] Ro8 Preview Pt1: Inheritors Leta's ASL S21 Ro.16 review FlaSh: This Will Be My Final ASL【ASL S21 Ro.16】 BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[ASL21] Ro16 Group D [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 [ASL21] Ro16 Group C
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Dawn of War IV Diablo IV Total Annihilation Server - TAForever Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1598 users

The Big Programming Thread - Page 405

Forum Index > General Forum
Post a Reply
Prev 1 403 404 405 406 407 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 17:23 GMT
#8081
On December 05 2013 02:01 ThatGuy wrote:
Then let's continue the investigation ^^ can I see the CState.h? :D


Yeah alright.

+ Show Spoiler +
#ifndef CSTATE_H
#define CSTATE_H

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>



/**
* Class CState
* Description: Acts as a base class for all different game states.
**/

//namespace tpe {

class CGame;

class CState {
// Our state manager needs full access.
friend class CStateMachine;

public:
// == Constructors
CState();
virtual ~CState();

// == Methods
virtual void OnInit(CGame* _game);

virtual void OnDestroy(CGame* _game);

virtual bool OnLoop(CGame* _game);

virtual bool OnDraw(CGame* _game);

virtual void OnEvent(CGame* _game);

protected:
// == Members

/**
* Local time, keeps track of time since start of this state.
*/
sf::Time m_localTime;
/**
* This state ID
*/
unsigned int m_stateId;

};

//}

#endif
Set it ablaze!
tofucake
Profile Blog Joined October 2009
Hyrule19208 Posts
December 04 2013 17:46 GMT
#8082
what the hell is going on with your whitespace

also, comments for everything are counter-productive, especially if you're naming stuff properly
Liquipediaasante sana squash banana
Nausea
Profile Joined October 2010
Sweden807 Posts
Last Edited: 2013-12-04 17:50:51
December 04 2013 17:50 GMT
#8083
On December 05 2013 02:46 tofucake wrote:
what the hell is going on with your whitespace

also, comments for everything are counter-productive, especially if you're naming stuff properly


As a noob I like to keep it clean and comment a lot so I easily can see what I was thinking when I made the shit. Might not be needed for everyone but I like it. But thank you for your productive comment.
Set it ablaze!
tofucake
Profile Blog Joined October 2009
Hyrule19208 Posts
December 04 2013 17:54 GMT
#8084
don't sass me
Liquipediaasante sana squash banana
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 18:21 GMT
#8085
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.
Set it ablaze!
Rombur
Profile Joined January 2011
Belgium107 Posts
December 04 2013 18:23 GMT
#8086
Nausea,

did you try this ?

bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);

Jinro, Rain, Sting, Byun, Alive, Bomber Fighting
KeksX
Profile Blog Joined November 2010
Germany3634 Posts
Last Edited: 2013-12-04 18:25:12
December 04 2013 18:24 GMT
#8087
@Nausea:
First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables.
Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!

That being said:
Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.

EDIT: Derp
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 18:32 GMT
#8088
On December 05 2013 03:23 Rombur wrote:
Nausea,

did you try this ?

bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);



I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho
Set it ablaze!
tofucake
Profile Blog Joined October 2009
Hyrule19208 Posts
December 04 2013 18:40 GMT
#8089
On December 05 2013 03:21 Nausea wrote:
Show nested quote +
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.
Liquipediaasante sana squash banana
KeksX
Profile Blog Joined November 2010
Germany3634 Posts
December 04 2013 18:43 GMT
#8090
On December 05 2013 03:32 Nausea wrote:
Show nested quote +
On December 05 2013 03:23 Rombur wrote:
Nausea,

did you try this ?

bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);



I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho


What was the issue, may I ask?

Glad you solved your problem, and GL with your project! SFML rocks!
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
December 04 2013 18:44 GMT
#8091
What was the problem? I wanted to figure it out too .

On December 05 2013 03:24 KeksX wrote:
@Nausea:
First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables.
Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!

That being said:
Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.

EDIT: Derp


Init and Destroy are useful for pooling, in case you want to avoid the object creation overhead. Considering that his code looks oriented for a game, it doesn't seem implausible. As for the prefixes, if they are event callbacks, then they seem appropriate; otherwise I would agree.
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 18:47 GMT
#8092
On December 05 2013 03:43 KeksX wrote:
Show nested quote +
On December 05 2013 03:32 Nausea wrote:
On December 05 2013 03:23 Rombur wrote:
Nausea,

did you try this ?

bool CStateMachine::SetState(CState* _state, tpe::CGame* const _game, unsigned int _id);



I actually just solved the problem. This error actually had nothing to do with it. And when the other stuff got fixed, this one solved itself. Thank you all for trying to help me tho


What was the issue, may I ask?

Glad you solved your problem, and GL with your project! SFML rocks!


Was a pretty simple problem, almost so simple I don't want to tell you xD
I have the state class as a base class for other states. and the other states are kept outside the tpe namespace. So I needed to make sure they inherit tpe::CState och that all CGame* are prefixed with tpe::.

Oh well, at least I learned something.
Set it ablaze!
KeksX
Profile Blog Joined November 2010
Germany3634 Posts
Last Edited: 2013-12-04 18:50:05
December 04 2013 18:49 GMT
#8093
On December 05 2013 03:44 ThatGuy wrote:
What was the problem? I wanted to figure it out too .

Show nested quote +
On December 05 2013 03:24 KeksX wrote:
@Nausea:
First some general tips: Your prefixes are really confusing, I know that you learn that kind of stuff in books but in reality it makes your code less readable. Exception for this is "m_" or "_" for member functions/variables.
Also, never ever use Init() and Destroy() functions. Thats what Constructors and Destructors are for!

That being said:
Could you please post the implementation of the class where you actually call the function? Header and implementation of CGame? Your error is almost 100% due to wrong declration. Try using tpe::CGame*.

EDIT: Derp


Init and Destroy are useful for pooling, in case you want to avoid the object creation overhead. Considering that his code looks oriented for a game, it doesn't seem implausible. As for the prefixes, if they are event callbacks, then they seem appropriate; otherwise I would agree.


That is true, but I think it's bad practice if you do not explicitly need it. Especially for beginners it tends to manifest and eventually they will always use Init() and Destroy() even though it is practically useless.

Using c for Callbacks is acceptable, but I prefer to just write out "CallbackX" or "XCallback" to clarify, but thats just personal preference I guess.


@Nausea:
The simple errors are those that will haunt you allll the time. Gj for fixing it! :D
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 19:07 GMT
#8094
On December 05 2013 03:40 tofucake wrote:
Show nested quote +
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.
Set it ablaze!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
December 04 2013 19:29 GMT
#8095
On December 05 2013 04:07 Nausea wrote:
Show nested quote +
On December 05 2013 03:40 tofucake wrote:
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.

I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).
If you have a good reason to disagree with the above, please tell me. Thank you.
Nausea
Profile Joined October 2010
Sweden807 Posts
December 04 2013 19:32 GMT
#8096
On December 05 2013 04:29 spinesheath wrote:
Show nested quote +
On December 05 2013 04:07 Nausea wrote:
On December 05 2013 03:40 tofucake wrote:
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.

I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).


Aha! Ok, thank you. May look into that.
Set it ablaze!
Cyx.
Profile Joined November 2010
Canada806 Posts
December 04 2013 19:48 GMT
#8097
On December 05 2013 03:40 tofucake wrote:
Show nested quote +
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


ROFL

oh come on, that was pretty funny. And I thought he was being genuine when he thanked you. He's Swedish bro... for someone whose first language may or may not be English, I would be perfectly willing to believe they said that meaning well. But then again he did burn you fucking HARD for someone who doesn't speak good English afterwards... oh well, it was funny either way ^^
tofucake
Profile Blog Joined October 2009
Hyrule19208 Posts
December 04 2013 20:07 GMT
#8098
bah, swedes all speak better english than native speakers anyway
Liquipediaasante sana squash banana
misirlou
Profile Joined June 2010
Portugal3300 Posts
December 04 2013 20:08 GMT
#8099
On December 05 2013 04:29 spinesheath wrote:
Show nested quote +
On December 05 2013 04:07 Nausea wrote:
On December 05 2013 03:40 tofucake wrote:
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.

I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).


Hm, I know that python will for some reason derp if you use 4 spaces and tabs in the same file. Do you think using 4 spaces is advantageous/better pratice than using tabs? I always used tabs and I only started seeing the 4 spaces from python code in the web.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-12-04 20:21:25
December 04 2013 20:19 GMT
#8100
On December 05 2013 05:08 misirlou wrote:
Show nested quote +
On December 05 2013 04:29 spinesheath wrote:
On December 05 2013 04:07 Nausea wrote:
On December 05 2013 03:40 tofucake wrote:
On December 05 2013 03:21 Nausea wrote:
On December 05 2013 02:54 tofucake wrote:
don't sass me


sass you? I guess you thought your own post was so shitty that you by accident thought I was being sarcastic.

It didn't answer the particular question at hand, and "But thank you for your productive comment." has never before in the history of the internet been said genuinely.


Yeah, well you didn't exactly answer my question either before that, the one that the discussion about my code was really about. And now when I looked at the code posted, the "code"-tags here add "white space" all over that does not exist in the actual code.

I'm fairly sure it's because you use actual tabs in your source code as opposed to 4 spaces (usually your code editor has an option to replace tabs with N spaces).


Hm, I know that python will for some reason derp if you use 4 spaces and tabs in the same file. Do you think using 4 spaces is advantageous/better pratice than using tabs? I always used tabs and I only started seeing the 4 spaces from python code in the web.

Tabs have more potential to mess up layouts. Spaces are always 1 character wide in monospaced fonts, which you will generally use for programming. Tabs usually are either 4 or 8 spaces wide, and sometimes you can adjust their width to whatever you like. You can't always make sure your tabs are displayed with the width. For example, the code browser on Sourceforge seems to use 8 spaces wide tabs.

Tabs have some minor advantages for editing code (less characters to move through or delete), but I don't really miss those having switched to spaces fairly recently. Especially because I'm usually not navigating single characters but rather use stuff like ctrl+arrow or end.

The advantages of using spaces over tabs aren't exactly massive either, though. I don't know a situation where it matters other than pasting code into different text display programs.
If you have a good reason to disagree with the above, please tell me. Thank you.
Prev 1 403 404 405 406 407 1032 Next
Please log in or register to reply.
Live Events Refresh
BSL
19:00
RO16 TieBreaker - Group B
Artosis vs Jimin
cavapoo vs LancerX
ZZZero.O419
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 498
elazer 161
ROOTCatZ 155
ProTech133
StarCraft: Brood War
Calm 2286
ZZZero.O 444
Mini 317
Horang2 281
ggaemo 122
Dewaltoss 101
NaDa 9
Dota 2
monkeys_forever246
League of Legends
Doublelift3187
JimRising 408
Super Smash Bros
C9.Mang01075
Mew2King84
Heroes of the Storm
Khaldor284
Other Games
gofns14183
tarik_tv10203
summit1g9447
Grubby4035
crisheroes233
ToD194
uThermal135
UpATreeSC53
kaitlyn34
Organizations
Other Games
gamesdonequick1204
BasetradeTV375
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• Hupsaiya 42
• davetesta18
• musti20045 16
• Kozan
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• 3DClanTV 42
• Airneanach23
• RayReign 7
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21488
Other Games
• imaqtpie1233
• Scarra896
Upcoming Events
CranKy Ducklings
1h 57m
Replay Cast
10h 57m
Afreeca Starleague
11h 57m
Soma vs hero
Wardi Open
12h 57m
Monday Night Weeklies
17h 57m
Replay Cast
1d 1h
Replay Cast
1d 10h
Afreeca Starleague
1d 11h
Leta vs YSC
Replay Cast
3 days
The PondCast
3 days
[ Show More ]
KCM Race Survival
3 days
Replay Cast
4 days
Replay Cast
4 days
Escore
4 days
Replay Cast
5 days
Replay Cast
5 days
IPSL
5 days
Ret vs Art_Of_Turtle
Radley vs TBD
BSL
5 days
Replay Cast
6 days
uThermal 2v2 Circuit
6 days
BSL
6 days
IPSL
6 days
eOnzErG vs TBD
G5 vs Nesh
Liquipedia Results

Completed

Escore Tournament S2: W4
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W5
KK 2v2 League Season 1
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.