I don't mind the switch statement bit, but it can be fixed in other ways if it's problematic. For example:Code: [Select]char* flavorText;
switch(LCSrandom(4))
{
case 0:
flavorText = "You keep the gas floored!";
break;
case 1:
flavorText = "You swerve around the next corner!";
break;
case 2:
flavorText = "You screech through an empty lot to the next street!";
break;
case 3:
if(yourworst>15)
flavorText = "You boldly weave through oncoming traffic!";
else
flavorText = "You make obscene gestures at the pursuers!";
break;
}
addstr(flavorText, gamelog);
gamelog.newline();
I see a couple issues with merging the gamelog.newline() call into addstr:
1. Curses already has a bunch of boggling variants on addstr, like mvwaddnstr.
To me, addstrl looks to me like it should affect how the text is displayed, or at least give me additional options in the parameter list about how I want the text displayed. If it has no impact on the parameter list or on displaying text, that will likely be unintuitive to people who have past experience with Curses.
2. The difference between addstrl and addstr isn't self-documenting.
When I'm assessing how to best integrate logging into the current system for displaying text, I'm worried about code readability. If I'm a new developer to the project, pulling up the source code, how will I know when I should use addstr and when should I use addstrl? I won't be able to figure out what that function does from seeing its name or how it's used -- I won't even know that the difference has something to do with logging rather than displaying text. I will likely be confused, because they appear to do the same thing. There's a good chance that I'll code and use one when they should have used the other, thus creating minor bugs in the logger that other programmers will have to clean up later.Code: [Select]addstr(cr->name, log);
addstr(" turns the tables on ", log);
addstr(a->name, log);
addstrl("!", log); // It's not obvious what the difference is here
addstr(a->name, log);
addstr(" has been tainted with wisdom!", log);
gamelog.endmessage(); // This leads to point #3...
3. You will need a variant for double newlines as well.
Both of the above concerns get worse when you have a distinction between endmessage() and newline(), and are trying to represent both with single-character variations on addstr's function name.
for(int p=0;p<pool.size();p++)
{
if(!pool[p]->alive)
{
addstr("The Liberal " , gamelog);
addstr(pool[p].name , gamelog);
addstr(" is dead!" , gamelog);
gamelog.newline();
}
}
gamelog.newline();
// Need a flush function here.
adstr("Something happens!");
gamelog.nextMessage();Actually, a better idea would be to make gamelog.newLine() write the buffer to the file. There isn't anything wrong with that, is there?
EDIT: Why is the random seed saved with the game? I noticed it after I kept reloading. (I added an incredibly useful debug define to disable saving.) Everything always happened the same. It was like Groundhog Day.
Hi gents, programming related query for you.
The main thread seems to indicate that i need VC++2010, but VC++2010 doesn't seem to recognize the project solution and instead thinks it's from an older VC++ and thus wants to convert it. However converting it breaks a great deal of configuration to the extent where it becomes unusable. Just to check do i indeed need VC++2010 and not an older version? Also is the SVN link in the main thread still correct, perhaps i'm checking out the wrong SVN?
Also since express 2012 came out, your VC++2010 link no longer works, not sure if you noticed.
Hi gents, programming related query for you.
The main thread seems to indicate that i need VC++2010, but VC++2010 doesn't seem to recognize the project solution and instead thinks it's from an older VC++ and thus wants to convert it. However converting it breaks a great deal of configuration to the extent where it becomes unusable. Just to check do i indeed need VC++2010 and not an older version? Also is the SVN link in the main thread still correct, perhaps i'm checking out the wrong SVN?
Also since express 2012 came out, your VC++2010 link no longer works, not sure if you noticed.
I use VC++ 2010 and it works fine for me. I had to convert it, as you did, and it did break some stuff. I managed to work around it by fiddling with the project settings.
Hmm... I doubt that many people still use VC++ 6 or whatever the .sln version is in trunk. Would it be a good idea to add a 2010 solution file but keep the old one as default? People could just rename the two files and use the 2010 .sln.
-snip for tidyness-
Are you calling my IDE old and busted? You people wound me! And after I upgraded to Visual Studio 2008 and everything... :P
I suppose that I should at least upgrade to 2010. If 2012 express is out, is there a good reason to not just use that? I guess there's probably still a lot of people running XP and Vista.
I've been working on organizing the fight logs. If I just used gamelog.nextMessage() after every message, it would be really disorganized. I decided to make it so that it makes a blank line between rounds.Spoiler: example fight log (click to show/hide)
That looks fantastic.
Note to self: there's a log message for when you leave a site, but not when you enter a site. (I think because it's in a different file that hasn't had logging added to, yet.)
Update: -BEEEP- -BEEEP- -BEEEP-
Unfortunately the Conservative metal detector insists on alarming no matter the situation: my test-character couldn't take his .44 Magnum (IIRC that's acceptable for security or police) through the front door of the nuke plant even in a Security, Police, or even Death Squad Uniform. Death Squads are active at the moment. Not sure if my having a Lab Tech sleeper on-site derails the disguise-check, but I'm thinking that might be the culprit. It does cancel mentioning that the squad actually goes through the detector, which they might or might not depending on the site/badges.
This sounds weird. The intended behavior when you have a sleeper is that you flash badges and get waved in. If you see the badge flashing text, there shouldn't be any way you'd get the metal detector going off -- the same trigger that shows that text should also prevent the game from checking for weapons at all.
Further edit, after taking another look at mapspecials.cpp: when a bouncer-checkpoint autoadmits, it also selfdestructs so far as I can tell; the remaining Club Security sticks around but you can walk around the front door all you like. When a security checkpoint autoadmits, it changes to a "secondvisit" encounter, which doesn't have a value for metal-detecting or not. Is it possible that the second-visit somehow doesn't carry over the autoadmit, but does carry over the detector?
Further edit, after taking another look at mapspecials.cpp: when a bouncer-checkpoint autoadmits, it also selfdestructs so far as I can tell; the remaining Club Security sticks around but you can walk around the front door all you like. When a security checkpoint autoadmits, it changes to a "secondvisit" encounter, which doesn't have a value for metal-detecting or not. Is it possible that the second-visit somehow doesn't carry over the autoadmit, but does carry over the detector?
The "secondvisit" encounter just spawns a couple of security guards, they shouldn't frisk you or send you through the metal detector. Should be the same as the bouncer.
---------- PROGRAM STARTED ----------
A NEW CONSERVATIVE ERA
The Year is 2009.
Conservative President Paul Florez ends his second term with approval
ratings in the high 70s, and is succeeded by hardcore Arch-Conservative
Chris Warman.
With Conservatives sweeping into power in the House of Representatives
and Senate, and a Conservative majority in the Supreme Court of the
United States, commentators are hailing it as the beginning of a new
Conservative era.
President Chris Warman has asked the new Congress to move quickly
to rubber stamp his radical Arch-Conservative agenda. The left seems
powerless to stop this imminent trampling of Liberal Sanity and Justice.
In this dark time, the Liberal Crime Squad is born...
The Liberal Crime Squad has arrived at American Bank Corp.
Tricia Kindale says, "Do you want to hear something disturbing?"
Prostitute responds, "What?"
Tricia Kindale says, "Over thirty innocent people have been executed over the past decade."
Prostitute responds, "Dear me! Is there anything we can do?"
After more discussion, Prostitute agrees to come by later tonight.
A bank teller is available.
Tricia Kindale slips the teller a note: I HAVE A GUN. CASH PLEASE.
The bank teller reads the note, nods calmly, and slips several bricks of cash into the squad's bag.
The Liberal Crime Squad has left American Bank Corp.
Meeting with Erika Birkin, Prostitute
Tricia Kindale explains their views on torture.
Tricia Kindale comes off as slightly insane.
This whole thing was a mistake. There won't be another meeting.
The Liberal Crime Squad has arrived at The Oubliette.
The Liberal Crime Squad has arrived at Fire Station.
Tricia Kindale says, "Do you want to hear something disturbing?"
Firefighter responds, "No." <turns away>
You try the door, but it is locked.
Tricia Kindale unlocks the door!
You try the door, but it is locked.
Tricia Kindale unlocks the door!
You find: Kitschy Trinket
You try the door, but it is locked.
Tricia Kindale unlocks the door!
Tricia Kindale acts natural.
The Liberal Crime Squad has left Fire Station.
The Liberal Crime Squad has arrived at Stevenson's Department Store.
The Liberal Crime Squad has arrived at Police Station.
You try the door, but it is locked.
Tricia Kindale unlocks the door!
You find: PDA
You find: Laptop
You find: Cellphone
Police Officer sees the Squad's Liberal Weapons and lets forth a piercing Conservative alarm cry!
You try the door, but it is locked.
Tricia Kindale shoots at Police Gang Unit with a AR-15!
Tricia Kindale hits the left leg.
Police Officer shoots at Tricia Kindale with a Shotgun!
Police Officer hits the right leg.
Police Gang Unit shoots at Tricia Kindale with a MP5 SMG!
Police Gang Unit hits the left leg, striking three times.
Police Officer shoots at Tricia Kindale with a 9mm Semiauto!
Police Officer hits the body.
Tricia Kindale gasps a last breath and soils the floor.
Nobody can carry Martyr Tricia Kindale.
So looking at lawreference.cpp, as you can see it actually goes to C++ and whatever S(Soviet?) is, can the game actually utilize these? Or are these about as useful as a comment?
S seems to actually mean "Stalinist", but yeah -- it looks like some developers had an idea of adding an extra degree to the issue spectrum.
The idea was that you would have a special Game-Over screen if the Stalinists "win" the game by passing their Stalinist Amendment. It would not show up in normal play though, as the Stalinists generally adhere to a mixed platform of L+ and C+ ideas. The Stalinists was intended to be a sometimes-ally, sometimes-enemy of the LCS, and the player has to decide when to let them run free and when to crack down.So looking at lawreference.cpp, as you can see it actually goes to C++ and whatever S(Soviet?) is, can the game actually utilize these? Or are these about as useful as a comment?
C++ is used when showing laws on the Game Over screen, S is Soviet and isn't used by the game. Servant Corps did most of the work on those, if I'm not mistaken.
LCS is normally compiled with GCC and GNU Make (both come preinstalled on most Linux distros), and on Windows with Visual Studio Express, which was freeware until 2 years ago. Now it's a stripped-down version of the full VC++ and you have to pay for it after the trial expires.
int ccssleepercount=0;
for(int pl=0;pl<pool.size();pl++)
{
if(pool[pl]->flag & CREATUREFLAG_SLEEPER&&
(pool[pl]->type==CREATURE_CCS_VIGILANTE || pool[pl]->type==CREATURE_CCS_ARCHCONSERVATIVE ||
pool[pl]->type==CREATURE_CCS_MOLOTOV || pool[pl]->type==CREATURE_CCS_SNIPER))
{
ccssleepercount=1;
break;
}
}
if(ccssleepercount>1) // !! It will be 1 or 0, never >1
{ // It should be if(ccssleepercount)
erase();
set_color(COLOR_WHITE,COLOR_BLACK,1);
move(8,1);
addstr("You have received a sleeper warning that the CCS ", gamelog);
move(9,1);
addstr(" is gearing up to attack ", gamelog);
addstr(location[l]->name, gamelog);
addstr(".", gamelog);
gamelog.nextMessage();
refresh();
getch();
}
}
So I still look at this crazy ideas list every now and then, and someone of them don't really require big changes, things I could really easily put together, are all of these ideas a to do list for you Fox, or are they just ideas good and bad altogether? I wouldn't mind doing a few of them really quickly, but I'm also unsure of how to SVN contribute and all of that. Would it to just edit the SVN marked files and then do the SVN Commit thing?
If it uses 3 spaces consistently, I dont think its necessaryWhen I was making my mod, I mixed 3 and 4 space tabs, and there were no issues.
If it uses 3 spaces consistently, I dont think its necessaryWhen I was making my mod, I mixed 3 and 4 space tabs, and there were no issues.
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.If it uses 3 spaces consistently, I dont think its necessaryWhen 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.
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.
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
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
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)
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.
#Leave this to use [ and ]
pagekeys=brackets
#Uncomment to use . and /
#pagekeys=AZERTY
#Uncomment to use PGUP and PGDOWN
#pagekeys=page
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
#####################################################################
#####################################################################
## ##
## 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 = bracketsMy idea is to allow disabling the autosave from this file, as requested here (http://www.bay12forums.com/smf/index.php?topic=115686.msg4183106#msg4183106) but the code sucked so I rewrote it