Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5

Author Topic: LCS Programming Discussion Topic  (Read 10779 times)

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #45 on: April 18, 2013, 10:23:13 pm »

Popping in here to give my support to git and github. I always hear that git is very hard to get used to, but if you use a GUI tool it's much easier (tortoisegit makes things very easy indeed).

There's been a lot of awesome work done by people trying to help development recently. I would get back into it, but I've got other things going on at the moment. But mostly, the source code scares me. So many global variables...
Logged

KA101

  • Bay Watcher
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #46 on: April 18, 2013, 10:38:25 pm »

I just joined github to hopefully resolve a problem over with CataDDA.  Not intuitive for this non-coder, even with the windows shell.  Haven't tried sourceforge though.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #47 on: April 19, 2013, 02:47:42 pm »

Open question: Would it be productive to, like, regex the whole code base to convert the existing 3 space tabs into a more normal 4 space convention? I know 3 space tabs are really... uncommon.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #48 on: April 19, 2013, 02:55:02 pm »

If it uses 3 spaces consistently, I dont think its necessary
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?

ed boy

  • Bay Watcher
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #49 on: April 20, 2013, 07:05:21 am »

If it uses 3 spaces consistently, I dont think its necessary
When I was making my mod, I mixed 3 and 4 space tabs, and there were no issues.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #50 on: April 20, 2013, 12:42:50 pm »

If it uses 3 spaces consistently, I dont think its necessary
When I was making my mod, I mixed 3 and 4 space tabs, and there were no issues.

C++ doesn't care about whitespace, so there wouldn't be. But that isn't the purpose of keeping the tabs consistent. It's very difficult for other programmers to understand what they're looking at if you vary from the conventions, because the whole point of indenting in the first place is to ensure the visual structure of the code matches the logical structure of the code. When you change the manner in which you indent, the code becomes more difficult to comprehend. And code is arcane enough without making fellow coders tax their brains on reverse engineering the parts you wrote. Keeping tabs consistent is one of the universal rules if you work in a professional environment.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #51 on: April 22, 2013, 01:03:23 pm »

If it uses 3 spaces consistently, I dont think its necessary
When I was making my mod, I mixed 3 and 4 space tabs, and there were no issues.

C++ doesn't care about whitespace, so there wouldn't be. But that isn't the purpose of keeping the tabs consistent. It's very difficult for other programmers to understand what they're looking at if you vary from the conventions, because the whole point of indenting in the first place is to ensure the visual structure of the code matches the logical structure of the code. When you change the manner in which you indent, the code becomes more difficult to comprehend. And code is arcane enough without making fellow coders tax their brains on reverse engineering the parts you wrote. Keeping tabs consistent is one of the universal rules if you work in a professional environment.
If you change the indentation, please also remove the spaces at the end of the lines and leave one (only one) line break at the end of the files.


Edit:
I just joined github to hopefully resolve a problem over with CataDDA.  Not intuitive for this non-coder, even with the windows shell.  Haven't tried sourceforge though.
Just made my first commit to sourceforge and it took hours. Git isn't easy to get either but I don't think it's harder.

edit2:
Code: [Select]
make  all-recursive
make[1]: Entering directory `/media/data/programming/cpp/lcsgame'
Making all in src
make[2]: Entering directory `/media/data/programming/cpp/lcsgame/src'
g++ -DHAVE_CONFIG_H -I. -I..  -DINSTALL_DATA_DIR=\"/usr/local/share\"  -I../src -g -O2 -MT crimesquad-game.o -MD -MP -MF .deps/crimesquad-game.Tpo -c -o crimesquad-game.o `test -f 'game.cpp' || echo './'`game.cpp
In file included from game.cpp:73:0:
includes.h:889:10: error: extra qualification ‘Location::’ on member ‘getname’ [-fpermissive]
    char* Location::getname(bool shortname=false);
          ^
make[2]: *** [crimesquad-game.o] Error 1
make[2]: Leaving directory `/media/data/programming/cpp/lcsgame/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/media/data/programming/cpp/lcsgame'
make: *** [all] Error 2

r644 broke it, r643 dies with something else:
Code: [Select]
terminate called after throwing an instance of 'std::bad_alloc'
                                                                 what():  std::bad_alloc
                                                                                        Aborted (core dumped)
« Last Edit: April 23, 2013, 12:19:37 am by seth-- »
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #52 on: April 23, 2013, 11:09:07 am »

Code: [Select]
make  all-recursive
make[1]: Entering directory `/media/data/programming/cpp/lcsgame'
Making all in src
make[2]: Entering directory `/media/data/programming/cpp/lcsgame/src'
g++ -DHAVE_CONFIG_H -I. -I..  -DINSTALL_DATA_DIR=\"/usr/local/share\"  -I../src -g -O2 -MT crimesquad-game.o -MD -MP -MF .deps/crimesquad-game.Tpo -c -o crimesquad-game.o `test -f 'game.cpp' || echo './'`game.cpp
In file included from game.cpp:73:0:
includes.h:889:10: error: extra qualification ‘Location::’ on member ‘getname’ [-fpermissive]
    char* Location::getname(bool shortname=false);
          ^
make[2]: *** [crimesquad-game.o] Error 1
make[2]: Leaving directory `/media/data/programming/cpp/lcsgame/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/media/data/programming/cpp/lcsgame'
make: *** [all] Error 2

r644 broke it, r643 dies with something else:
Code: [Select]
terminate called after throwing an instance of 'std::bad_alloc'
                                                                 what():  std::bad_alloc
                                                                                        Aborted (core dumped)

The first issue should be dealt with now. I'm mildly surprised that it wasn't even warned about by the Visual Studio project. (I would be more than mildly surprised if the project weren't set to be pretty permissive with code quality.) The second is occurring because r643 broke save compatibility and it's trying and failing to load your existing save game -- you will need to manually delete the old save file.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #53 on: April 24, 2013, 02:11:44 pm »

I rewrote the loadinitfile function
It now uses LCSOpenFileCPP to open the init.txt file, searching for it in ~/.lcs/ like it's done with gamelog.txt and save.dat
I want to include a default init.txt but I have now idea of how to do make the installer copy it.
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #54 on: April 24, 2013, 02:59:36 pm »

I rewrote the loadinitfile function
It now uses LCSOpenFileCPP to open the init.txt file, searching for it in ~/.lcs/ like it's done with gamelog.txt and save.dat
I want to include a default init.txt but I have now idea of how to do make the installer copy it.

The makefile.am in /trunk/ (not the identically named file in /trunk/src/) enumerates all the files that should be moved to the art directory in the install. Figuring out how it does that should lead you to a way to copy init.txt to the save directory in the install process.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #55 on: April 24, 2013, 04:56:24 pm »

Where are gamelog.txt and save.dat created in windows? src/?
As there is no makefile there I should put init.txt in the same folder, right? It feels weird, as it's not source code

Edit: I've commited the code but still I'm not sure how to do the file thing. Here is a init.txt for those wanting to test:
Code: [Select]
#Leave this to use [ and ]
pagekeys=brackets

#Uncomment to use . and /
#pagekeys=AZERTY

#Uncomment to use PGUP and PGDOWN
#pagekeys=page
« Last Edit: April 24, 2013, 06:38:28 pm by seth-- »
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #56 on: April 25, 2013, 04:00:30 pm »

Where are gamelog.txt and save.dat created in windows? src/?
As there is no makefile there I should put init.txt in the same folder, right? It feels weird, as it's not source code

Edit: I've commited the code but still I'm not sure how to do the file thing. Here is a init.txt for those wanting to test:
Code: [Select]
#Leave this to use [ and ]
pagekeys=brackets

#Uncomment to use . and /
#pagekeys=AZERTY

#Uncomment to use PGUP and PGDOWN
#pagekeys=page

init.txt is not created by the game in Windows. It comes in the game's zip file and lives in the top directory (same as the .exe). I'm a bit surprised, but it doesn't look like it's in the SVN repository.

Here's the init.txt packed with the game's Windows download:

Code: [Select]
#####################################################################
#####################################################################
##                                                                 ##
##           Configuration File for Liberal Crime Squad            ##
##                                                                 ##
#####################################################################
#####################################################################

#####################################################################
##                        Interface Options                        ##
#####################################################################

Change "brackets" to "page" to use pgup/pgdn to scroll in menus.
You might have to try both or fiddle with numloc and the pgup/pgdn
on your number pad to find a combination that works.

Alternatively, replace the word after pagekeys with "AZERTY" to use
the ; and : keys to scroll in menus, specifically designed for the
AZERTY keyboard layout. Note that setting AZERTY here causes the
game to do a number of additional conversions to make the keyboard
input easier, ignoring the effect of capslock on the number keys
(allowing & é " etc to be used in place of their corresponding
numbers) and making '.' and '/' interchangable with ';' and ':'.


pagekeys = brackets

This is a really peripheral file that is irrelevant to most players, which is probably why nobody's ever noticed or mentioned the fact that it doesn't come with the Linux version until now. The file was originally created to let you toggle to the brackets setting if the pageup/pagedown options don't work, but they don't work for so many people that I changed the default and never looked back. The newer AZERTY setting is probably the only really useful feature these days -- its handful of features should make the interface a notably less hostile for anyone playing on a French keyboard.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #57 on: April 25, 2013, 04:07:27 pm »

My idea is to allow disabling the autosave from this file, as requested here but the code sucked so I rewrote it
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: LCS Programming Discussion Topic
« Reply #58 on: April 25, 2013, 04:25:04 pm »

My idea is to allow disabling the autosave from this file, as requested here but the code sucked so I rewrote it

That sounds like a good idea to me.
Logged

seth--

  • Bay Watcher
  • We need a slogan!
    • View Profile
Re: LCS Programming Discussion Topic
« Reply #59 on: April 27, 2013, 10:34:17 pm »

I had to read the K&R book to finally understand variable scope in c++ but autosave can be disabled now

Still init.txt isn't copied by make. If somebody knows how to do it, please contribute. If not, it's time to read the automake documentation.
Logged
I am confused are you saying you changed the kidnapping so it is less... Saw?
Did Saw consist of you beating them then yelling Ronald Reagan in their face?
Pages: 1 2 3 [4] 5