Bay 12 Games Forum

Please login or register.

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

Author Topic: Fixes for Code::Blocks IDE  (Read 8624 times)

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Fixes for Code::Blocks IDE
« on: July 29, 2013, 05:48:24 pm »

I tried compiling Liberal Crime Squad's latest SVN version in Code::Blocks under Windows (32-bit). Well it turns out the "game.cbp" file in the "workspaces" directory has a few problems. First of all, it's only set up to tell where to find header files and such for Debug builds, not for Release builds, so you can't compile or build Release builds, just Debug ones. But then, there is even a problem there, because the "news.cpp" file is in the "news" directory rather than the "daily" directory like the "game.cbp" file says. So I fixed both of those problems. Also it was only set up to do optimization level -O2 for GCC instead of -O3, and -O3 optimizes the code to run the fastest. So I fixed that too. Then I noticed that the compiled program I got from this, in Code::Blocks, had no icon. So I looked up how to give an icon to a program. Apparently I had to write a short file with the ".rc" extension to tell it to include the icon in "lcs_news_icon.ico". So I called the file "lcs_news_icon.rc" and put it in the same "workspaces" directory as both "lcs_news_icon.ico" and "game.cbp", and added it as a resource to the project/workspace/whatever. Anyway, this worked, and now the program compiles and builds perfectly in Code::Blocks under 32-bit Windows, and has the icon built-in, and is optimized to run as fast as possible. So, since I don't have the ability to modify code in the SourceForge project, I am going to list the contents of both files, my updated "game.cbp" and the "lcs_news_icon.rc" that goes in the same "workspaces" directory. This way you'll be able to compile and build this in Code::Blocks without any problems.

Here is my new updated "game.cbp" file in the "workspaces" directory:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Liberal Crime Squad" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="Debug/crimesquad.exe" prefix_auto="0" extension_auto="0" />
<Option object_output="Debug/obj" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add directory="../src" />
<Add directory="../src/pdcurses" />
</Compiler>
<Linker>
<Add library="..\src\pdcurses\pdcurses.lib" />
</Linker>
</Target>
<Target title="Release">
<Option output="Release/crimesquad.exe" prefix_auto="0" extension_auto="0" />
<Option object_output="Release/obj" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-O3" />
<Add directory="../src" />
<Add directory="../src/pdcurses" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="..\src\pdcurses\pdcurses.lib" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="../src/basemode/activate.cpp" />
<Unit filename="../src/basemode/activate_sleepers.cpp" />
<Unit filename="../src/basemode/baseactions.cpp" />
<Unit filename="../src/basemode/basemode.cpp" />
<Unit filename="../src/basemode/liberalagenda.cpp" />
<Unit filename="../src/basemode/reviewmode.cpp" />
<Unit filename="../src/cmarkup/Markup.cpp" />
<Unit filename="../src/cmarkup/Markup.h" />
<Unit filename="../src/combat/chase.cpp" />
<Unit filename="../src/combat/fight.cpp" />
<Unit filename="../src/combat/haulkidnap.cpp" />
<Unit filename="../src/common/commonactions.cpp" />
<Unit filename="../src/common/commondisplay.cpp" />
<Unit filename="../src/common/consolesupport.cpp" />
<Unit filename="../src/common/equipment.cpp" />
<Unit filename="../src/common/getnames.cpp" />
<Unit filename="../src/common/help.cpp" />
<Unit filename="../src/common/misc.cpp" />
<Unit filename="../src/common/translateid.cpp" />
<Unit filename="../src/compat.cpp" />
<Unit filename="../src/compat.h" />
<Unit filename="../src/configfile.cpp" />
<Unit filename="../src/configfile.h" />
<Unit filename="../src/creature/creature.cpp" />
<Unit filename="../src/creature/creature.h" />
<Unit filename="../src/creature/creaturenames.cpp" />
<Unit filename="../src/creature/creaturetypes.cpp" />
<Unit filename="../src/cursesgraphics.cpp" />
<Unit filename="../src/cursesgraphics.h" />
<Unit filename="../src/cursesmovie.cpp" />
<Unit filename="../src/cursesmovie.h" />
<Unit filename="../src/daily/activities.cpp" />
<Unit filename="../src/daily/daily.cpp" />
<Unit filename="../src/daily/date.cpp" />
<Unit filename="../src/daily/interrogation.cpp" />
<Unit filename="../src/daily/recruit.cpp" />
<Unit filename="../src/daily/shopsnstuff.cpp" />
<Unit filename="../src/daily/siege.cpp" />
<Unit filename="../src/externs.h" />
<Unit filename="../src/game.cpp" />
<Unit filename="../src/includes.h" />
<Unit filename="../src/items/armor.cpp" />
<Unit filename="../src/items/armor.h" />
<Unit filename="../src/items/armortype.cpp" />
<Unit filename="../src/items/armortype.h" />
<Unit filename="../src/items/clip.cpp" />
<Unit filename="../src/items/clip.h" />
<Unit filename="../src/items/cliptype.cpp" />
<Unit filename="../src/items/cliptype.h" />
<Unit filename="../src/items/item.cpp" />
<Unit filename="../src/items/item.h" />
<Unit filename="../src/items/itemtype.cpp" />
<Unit filename="../src/items/itemtype.h" />
<Unit filename="../src/items/loot.cpp" />
<Unit filename="../src/items/loot.h" />
<Unit filename="../src/items/loottype.cpp" />
<Unit filename="../src/items/loottype.h" />
<Unit filename="../src/items/money.cpp" />
<Unit filename="../src/items/money.h" />
<Unit filename="../src/items/weapon.cpp" />
<Unit filename="../src/items/weapon.h" />
<Unit filename="../src/items/weapontype.cpp" />
<Unit filename="../src/items/weapontype.h" />
<Unit filename="../src/lcsio.cpp" />
<Unit filename="../src/lcsio.h" />
<Unit filename="../src/locations/locations.cpp" />
<Unit filename="../src/locations/world.cpp" />
<Unit filename="../src/log/log.cpp" />
<Unit filename="../src/log/log.h" />
<Unit filename="../src/monthly/endgame.cpp" />
<Unit filename="../src/monthly/justice.cpp" />
<Unit filename="../src/monthly/lcsmonthly.cpp" />
<Unit filename="../src/monthly/monthly.cpp" />
<Unit filename="../src/monthly/sleeper_update.cpp" />
<Unit filename="../src/news/ads.cpp" />
<Unit filename="../src/news/headline.cpp" />
<Unit filename="../src/news/layout.cpp" />
<Unit filename="../src/news/majorevent.cpp" />
<Unit filename="../src/news/news.cpp" />
<Unit filename="../src/news/news.h" />
<Unit filename="../src/news/squadstory_text.cpp" />
<Unit filename="../src/pdcurses/curses.h" />
<Unit filename="../src/politics/alignment.h" />
<Unit filename="../src/politics/law.cpp" />
<Unit filename="../src/politics/law.h" />
<Unit filename="../src/politics/politics.cpp" />
<Unit filename="../src/sandbox/creature_test.h" />
<Unit filename="../src/sandbox/globals.h" />
<Unit filename="../src/sandbox/injury_test.h" />
<Unit filename="../src/sandbox/lcscommon.h" />
<Unit filename="../src/sandbox/location_test.h" />
<Unit filename="../src/sandbox/weapon.h" />
<Unit filename="../src/sitemode/advance.cpp" />
<Unit filename="../src/sitemode/mapspecials.cpp" />
<Unit filename="../src/sitemode/miscactions.cpp" />
<Unit filename="../src/sitemode/newencounter.cpp" />
<Unit filename="../src/sitemode/shop.cpp" />
<Unit filename="../src/sitemode/shop.h" />
<Unit filename="../src/sitemode/sitedisplay.cpp" />
<Unit filename="../src/sitemode/sitemap.cpp" />
<Unit filename="../src/sitemode/sitemap.h" />
<Unit filename="../src/sitemode/sitemode.cpp" />
<Unit filename="../src/sitemode/stealth.cpp" />
<Unit filename="../src/sitemode/talk.cpp" />
<Unit filename="../src/title/highscore.cpp" />
<Unit filename="../src/title/initfile.cpp" />
<Unit filename="../src/title/newgame.cpp" />
<Unit filename="../src/title/saveload.cpp" />
<Unit filename="../src/title/titlescreen.cpp" />
<Unit filename="../src/vector.h" />
<Unit filename="../src/vehicle/vehicle.cpp" />
<Unit filename="../src/vehicle/vehicle.h" />
<Unit filename="../src/vehicle/vehicletype.cpp" />
<Unit filename="../src/vehicle/vehicletype.h" />
<Unit filename="lcs_news_icon.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
<editor_config active="1" use_tabs="1" tab_indents="0" tab_width="3" indent="3" eol_mode="0" />
<DoxyBlocks>
<comment_style block="0" line="0" />
<doxyfile_project />
<doxyfile_build />
<doxyfile_warnings />
<doxyfile_output />
<doxyfile_dot />
<general />
</DoxyBlocks>
</Extensions>
</Project>
</CodeBlocks_project_file>

Here is the new file "lcs_news_icon.rc" in that same "workspaces" directory":
Code: [Select]
#ifndef _resource_rc
#define _resource_rc

MAINICON ICON "lcs_news_icon.ico"

#endif

Anyway, somebody should update the project with both of these files, so that people who download the source code can compile it in Code::Blocks without any problems. Please. Thank you.

Oh, and if anyone is wondering which installer for Code::Blocks to download, if you want to compile Liberal Crime Squad in Windows, pick the one that has "mingw" in the filename but NOT "user" in the filename. Currently that is "codeblocks-12.11mingw-setup.exe", which you can find here. Then with the 2 files I gave the code for above, you'll be able to compile the source code for the latest SVN builds of Liberal Crime Squad (currently build 693). It might even work to compile for Linux or Mac OS X, I am not sure, but it definitely works for compiling it on Windows.

Anyway, I hope you include these 2 files I'm contributing so that compiling in Code::Blocks works again.

UPDATE: Updated "game.cbp" file so Release builds have the filename "crimesquad.exe" instead of "Liberal Crime Squad.exe" just as already done with Debug builds, and so that Release build objects are stored in an "obj" subdirectory just as already done with Debug builds.
« Last Edit: August 07, 2013, 10:21:39 pm by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Fixes for initfile.cpp
« Reply #1 on: August 01, 2013, 08:24:15 pm »

Alright, I've got another file I've updated, this one fixes some problems in initfile.cpp (in the title directory). Previously, initfile.cpp didn't remove whitespace (spaces and tabs) before or after the text in each line of the init.txt file that was being parsed. Now it does, so if you have spaces or tabs to the left or right of the various lines (currently the 2 variables that get specified in that file are called "pagekeys" and "autosave"), now those spaces and tabs get ignored and initfile.cpp correctly parses them. In addition, it used to check for "off", "0", or "false" for the "autosave", but not "no". I have added a check for the word "no" (so now it checks for "off", "0", "false", or "no").

Anyway, this improvement to init.txt file parsing, in my updated version of initfile.cpp, will make it correctly parse the init.txt file and this will be useful if more variables are added to it in the future besides those 2, but it also makes it much better at parsing the 2 current variables, "pagekeys" and "autosave".

So here is the new code for "initfile.cpp" (in the "title" directory):
Code: [Select]
/*
This file handles the loading of init.txt

This file is part of Liberal Crime Squad.

    Liberal Crime Squad is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Liberal Crime Squad is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Liberal Crime Squad; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307   USA

*/
#include "lcsio.h"
#include "externs.h"
#include "includes.h"

void setconfigoption(string name, string value)
{
   transform(name.begin(), name.end(), name.begin(), ::tolower);
   transform(value.begin(), value.end(), value.begin(), ::tolower);
   if(name == "pagekeys")
   {
      if(value == "azerty")
      {
         interface_pgup='.';
         interface_pgdn='/';
      }
      else if(value == "brackets")
      {
         interface_pgup='[';
         interface_pgdn=']';
      }
      else if(value == "page")
      {
         interface_pgup=-61;
         interface_pgdn=-55;
      }
   }
   else if(name == "autosave")
   {
      if((value == "off") or (value == "0") or (value == "false") or (value == "no"))
      {
         autosave=false;
      }
   }
}

void loadinitfile(void)
{
   ::fstream file;
   if (LCSOpenFileCPP("init.txt", ios::in, LCSIO_PRE_HOME, file))
   {
      string str;
      int posequal;

      while(getline(file, str))
      {
         str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
         str.erase(std::remove(str.begin(), str.end(), '\t'), str.end());

         if (! str.length()) continue;

         if (str[0] == '#') continue;
         if (str[0] == ';') continue;

         posequal=str.find('=');
         if(posequal==string::npos) continue;

         setconfigoption(str.substr(0,posequal), str.substr(posequal+1));
      }
   }
   file.close();
}

Anyway, I hope someone is looking at my code contributions... there are probably more on the way! My username on SourceForge is "yetisyny" in case you want to add me to the project and give me access to commit changes to the code myself. Otherwise I guess I'll just have to post the code here on the forum and wait for somebody who is a developer to find it... which hasn't happened yet, so I am wondering if anyone has noticed me or not. So yeah, along with the 2 files updated to fix LCS to work with Code::Blocks, this file, the updated initfile.cpp fixes some bugs with parsing init.txt, and I am hoping that someone with access to the project on SourceForge will commit these changes please, pretty please.

And one last thing... I have noticed that if I compile Liberal Crime Squad in Code::Blocks with the compiler optimizations all enabled (like I did in the modified "game.cbp" file that is posted in my previous post), the game goes through computationally intensive tasks like many days going by and processing every event that happens, it does this all MUCH faster than in the 4.07.3 beta build downloadable from Jonathan S. Fox's website. Yes, it makes the game run MUCH faster. It's really awesome.

Anyway, until my contributions are added to the main project, I will put all code contributions into this thread, because that way this thread will go to the top whenever I have new code contributions, and it will have ALL of my code contributions in it, and people not interested in looking at code won't have to look through multiple code-related threads I've started. I think it's just easiest for everyone if I keep this stuff in a single thread, so that developers/coders can look at this thread and ordinary users who just play the game can ignore it completely (since the vast majority of people on this forum are ordinary users who aren't involved in coding at all and probably have no interest in these technical details). And yes I probably have more work to come, and it would be quite helpful if I got access to the SourceForge project, since posting all the code here is quite inefficient, and nobody's put any of the code I wrote back into the project yet, which is kinda disappointing. I haven't had any feedback at all on any of this, really, and it's a bit frustrating, but I'll deal, I still have some more things that I might be able to improve. I'd just like some small sign that somebody is paying attention to what I'm doing, some feedback of some kind, whether or not they like it, whether or not this will get into the project or whether I can be part of the project as a coder myself. Thanks. ;)

UPDATE: the original version of the code I put here didn't remove whitespace next to the equals sign, so, for instance, while a line that said "    PageKeys=AZERTY   " or "   AutoSave=off   " would both work, "PageKeys = AZERTY" or "AutoSave = off" would NOT work in the original version (since it didn't discard spaces next to the equals sign). I have updated the code so that it removes ALL whitespace (space and tab characters) from each line. So now you can even have a line say something like "   Auto Save = off   " or "   Page Keys = AZERTY   " and it will still know what you mean and parse it as if there aren't any spaces or tabs. So if you copied and pasted the code from here from before I posted this UPDATE, please discard my old code and use this latest version of my code, since now it is even more versatile at parsing each line and ignoring whitespace. I thought about the option of removing leading and trailing whitespace for the entire string and on both sides of the equals sign but KEEPING whitespace inside the string on the left side of the equals sign and the string on the right side of the equals sign (so that, for instance, "  PageKeys = AZERTY  " would work but "  Page Keys = AZERTY  " would NOT work). However, I couldn't think of any real benefit to doing it that way, and it required longer and more complex code. It is much simpler from a coding perspective to just remove ALL whitespace, and there's no real reason not to do it that way, so that's the way it is done in the current version of the code here (only requiring one line of code to remove spaces and another line of code to remove tabs). Removing whitespace in a more selective manner (so that you couldn't have spaces in the middle of words and would have to have "pagekeys" and "autosave" as single words) would require more lines of code and provide no real benefit, so I didn't do it that way.

And if you are wondering why this is necessary, take a look at the init.txt file included with Liberal Crime Squad (here it is, unmodified):
Code: [Select]
#####################################################################
#####################################################################
##                                                                 ##
##           Configuration File for Liberal Crime Squad            ##
##                                                                 ##
#####################################################################
#####################################################################

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

#Leave this to use [ and ] to page through menus
    pagekeys=brackets

#Uncomment to use . and / and add other AZERTY keyboard improvements
    #pagekeys=AZERTY

#Uncomment to use PGUP and PGDOWN (doesn't work for many people)
    #pagekeys=page

#Uncomment this to disable saving between days
    #autosave=Off

Liberal Crime Squad, without my modifications to ignore whitespace in that file, fails to parse ANY of the lines, including the uncommented line that says "    pagekeys=brackets", because of the leading spaces. Luckily, the default setting for pagekeys is brackets, just like the default setting for autosave is on, if nothing from init.txt is parsed, so users who do not modify init.txt do not notice anything wrong. And if you follow the directions in the file and uncomment the line "    #autosave=Off" by removing the "#" character, autosave is STILL on, unless you use my modified code. My code fixes the parsing of this so the existing init.txt file that comes with the game actually works if users modify it from the defaults.
« Last Edit: August 02, 2013, 02:21:51 pm by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Bugfix for getting loot in sitemode.cpp
« Reply #2 on: August 03, 2013, 12:06:09 am »

Well here's another bugfix from me. This is an important one, this is one that makes the game crash. But I fixed it. Anyway, here goes explaining what the bug is: when you go to a site and press "G" to get loot, sometimes the game crashes. This happens at various types of apartments. Since my playing style involves doing lots of stealing loot at apartments, I encounter this bug very often, which is how I noticed the pattern of this bug with it crashing when you try to steal loot at apartments. Well it turns out the reason for this, in the source code, happens to be the source code for when you steal things in apartments... what a coincidence! Anyway, it's a very obvious bug in the code. Basically there are arrays of possible items it could be, and LCSrandom() is called, yet the parameter for LCSrandom() is a higher number than the array size, meaning that sometimes, the array size will be exceeded, which, of course, is something that crashes a program in C++. This bug is in the file "sitemode.cpp" in the "sitemode" directory. And the original versions of source code I am using for this bugfix as well as the previous ones in this thread, it is the source code from revision 693, the latest revision. Revision 693 has been the latest revision ever since July 6th at 4:01 pm according to SourceForge, and all my code in this thread is based on revision 693, the latest revision.

So anyway, "sitemode.cpp" is a VERY long file. So rather than fix the 2 lines of code in it that are wrong and then copy and paste the ENTIRE file here, I will just specify WHICH lines of code are wrong, and give the old and new versions for those 2 lines of code.

The first line of code with a bug is line 1381 of "sitemode.cpp". Here is the OLD version that is WRONG and crashes the game 1/8 of the time it is executed:
Code: [Select]
                        newWeaponType=rndWeps[LCSrandom(8)];

Here is the NEW version of line 1381 that is CORRECT and DOESN'T crash the game, and works fine:
Code: [Select]
                        newWeaponType=rndWeps[LCSrandom(7)];

The next line of code with a bug is line 1405 of "sidemode.cpp" Here is the OLD version that is WRONG and crashes the game 1/6 of the time it is executed:
Code: [Select]
                        newWeaponType=rndWeps[LCSrandom(6)];

Here is the NEW version of line 1405 that is CORRECT and DOESN'T crash the game, and works fine:
Code: [Select]
                        newWeaponType=rndWeps[LCSrandom(5)];

So yes, those are the 2 lines of "sitemode.cpp" that are wrong and need to be changed so the game won't be crashing when you try to steal loot in apartments. Anyway, this is my latest bugfix contribution. Hopefully all my contributions in this thread will be incorporated into the source code. Right now I'm not aware of any other bugs that need fixing, but if I find any, I'll be on it. I hope you all incorporate my various bug fixes. I do have some ideas for added features, that sort of thing, things that wouldn't really be bug fixes, but I've tried to mostly focus on just posting bug fixes here for the time being, since fixing bugs is more urgent than adding features, at least for me.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Secret Service naming bugfix for getnames.cpp
« Reply #3 on: August 04, 2013, 02:04:25 am »

If you ask out a Secret Service agent on a date (again, in revision 693, the latest revision of the code), and the Secret Service agent says yes, then on the date, their occupation will be listed as "Liberal" even though they are still a Conservative, and it will not list their occupation as Secret Service. Every other occupation, when you go on a date with them, it says their occupation correctly. And if you manage to get the Secret Service agent to join, either through seduction or interrogation, they will still have their occupation listed as "Liberal" instead of "Secret Service". Well this turns out to be a bug in the file "getnames.cpp", in the folder "common". There is a switch command that has cases for each creature type, giving them the occupation name, and the default if the creature type is not listed is "Liberal". This is in the function "void getrecruitcreature(char *str,int type)" (the one which renames several occupations, for instance renaming Guard Dog to Canine Hero, renaming News Anchor to Cable News Anchor, etc.) Well it turns out that CREATURE_SECRET_SERVICE was left out of the list of cases. So I fixed this bug, and now Secret Service agents get to keep being called "Secret Service" as their occupation.

Here is the new code for the function "void getrecruitcreature(char *str,int type)" in the file "getnames.cpp" in the folder "common":
Code: [Select]
void getrecruitcreature(char *str,int type)
{
   strcpy(str,"");

   switch(type)
   {
      case CREATURE_BOUNCER:strcat(str,"Club Security");break;
      case CREATURE_SECURITYGUARD:strcat(str,"Security Guard");break;
      case CREATURE_SCIENTIST_LABTECH:strcat(str,"Lab Tech");break;
      case CREATURE_SCIENTIST_EMINENT:strcat(str,"Eminent Scientist");break;
      case CREATURE_CORPORATE_MANAGER:strcat(str,"Corporate Manager");break;
      case CREATURE_CORPORATE_CEO:strcat(str,"Corporate CEO");break;
      case CREATURE_POLITICIAN:strcat(str,"Politician");break;
      case CREATURE_WORKER_SERVANT:
         if(law[LAW_LABOR]==-2&&
             law[LAW_CORPORATE]==-2)strcpy(str,"Slave");
         else strcat(str,"Servant");
         break;
      case CREATURE_WORKER_JANITOR:
             if(law[LAW_LABOR]==2)strcpy(str,"Custodian");
         else strcat(str,"Janitor");
         break;
      case CREATURE_WORKER_SWEATSHOP:
         if(law[LAW_IMMIGRATION]==2&&
             law[LAW_LABOR]==2)strcpy(str,"Migrant Worker");
         else strcat(str,"Sweatshop Worker");
         break;
      case CREATURE_WORKER_FACTORY_NONUNION:strcat(str,"Factory Worker");break;
      case CREATURE_WORKER_FACTORY_CHILD:strcat(str,"Child Worker");break;
      case CREATURE_WORKER_SECRETARY:strcat(str,"Secretary");break;
      case CREATURE_WORKER_FACTORY_UNION:strcat(str,"Factory Worker");break;
      case CREATURE_LANDLORD:strcat(str,"Landlord");break;
      case CREATURE_COP:strcat(str,"Police Officer");break;
      case CREATURE_SWAT:strcat(str,"SWAT Officer");break;
      case CREATURE_DEATHSQUAD:strcat(str,"DethSquad Officer");break;
      case CREATURE_GANGUNIT:strcat(str,"Police Gang Unit");break;
      case CREATURE_FIREFIGHTER:strcat(str,"Fire Fighter");break;
      case CREATURE_PRISONGUARD:strcat(str,"Prison Guard");break;
      case CREATURE_EDUCATOR:strcat(str,"Educator");break;
      case CREATURE_MERC:strcat(str,"Elite Security");break;
      case CREATURE_HICK:strcat(str,"Redneck");break;
      case CREATURE_SOLDIER:strcat(str,"Soldier");break;
      case CREATURE_VETERAN:strcat(str,"Veteran");break;
      case CREATURE_HARDENED_VETERAN:strcat(str,"Hardened Veteran");break;
      case CREATURE_JUDGE_LIBERAL:strcat(str,"Judge");break;
      case CREATURE_JUDGE_CONSERVATIVE:strcat(str,"Judge");break;
      case CREATURE_AGENT:strcat(str,"Agent");break;
      case CREATURE_RADIOPERSONALITY:strcat(str,"Radio Personality");break;
      case CREATURE_NEWSANCHOR:strcat(str,"Cable News Anchor");break;
      case CREATURE_LAWYER:strcat(str,"Lawyer");break;
      case CREATURE_SEWERWORKER:strcat(str,"Sewer Worker");break;
      case CREATURE_COLLEGESTUDENT:strcat(str,"College Student");break;
      case CREATURE_MUSICIAN:strcat(str,"Musician");break;
      case CREATURE_MATHEMATICIAN:strcat(str,"Mathematician");break;
      case CREATURE_TEACHER:strcat(str,"Teacher");break;
      case CREATURE_HSDROPOUT:strcat(str,"Highschool Dropout");break;
      case CREATURE_BUM:strcat(str,"Transient");break;
      case CREATURE_MUTANT:strcat(str,"Mutant");break;
      case CREATURE_GANGMEMBER:strcat(str,"Gang Member");break;
      case CREATURE_CRACKHEAD:strcat(str,"Crack Head");break;
      case CREATURE_PRIEST:strcat(str,"Priest");break;
      case CREATURE_ENGINEER:strcat(str,"Engineer");break;
      case CREATURE_FASTFOODWORKER:strcat(str,"Fast Food Worker");break;
      case CREATURE_TELEMARKETER:strcat(str,"Telemarketer");break;
  case CREATURE_CARSALESMAN:
if(law[LAW_WOMEN]==-2)strcpy(str,"Car Salesman");
         else strcat(str,"Car Salesperson");
         break;
  case CREATURE_OFFICEWORKER:strcat(str,"Office Worker");break;
      case CREATURE_FOOTBALLCOACH:strcat(str,"Football Coach");break;
      case CREATURE_PROSTITUTE:strcat(str,"Prostitute");break;
      case CREATURE_MAILMAN:strcat(str,"Mail Carrier");break;
      case CREATURE_GARBAGEMAN:strcat(str,"Garbage Collector");break;
      case CREATURE_PLUMBER:strcat(str,"Plumber");break;
      case CREATURE_CHEF:strcat(str,"Chef");break;
      case CREATURE_CONSTRUCTIONWORKER:strcat(str,"Construction Worker");break;
      case CREATURE_AMATEURMAGICIAN:strcat(str,"Amateur Magician");break;
      case CREATURE_HIPPIE:strcat(str,"Hippie");break;
      case CREATURE_CRITIC_ART:strcat(str,"Art Critic");break;
      case CREATURE_CRITIC_MUSIC:strcat(str,"Music Critic");break;
      case CREATURE_AUTHOR:strcat(str,"Author");break;
      case CREATURE_JOURNALIST:strcat(str,"Journalist");break;
      case CREATURE_SOCIALITE:strcat(str,"Socialite");break;
      case CREATURE_BIKER:strcat(str,"Biker");break;
      case CREATURE_TRUCKER:strcat(str,"Trucker");break;
      case CREATURE_TAXIDRIVER:strcat(str,"Taxi Driver");break;
      case CREATURE_PROGRAMMER:strcat(str,"Programmer");break;
      case CREATURE_NUN:strcat(str,"Nun");break;
      case CREATURE_RETIREE:strcat(str,"Retiree");break;
      case CREATURE_PAINTER:strcat(str,"Painter");break;
      case CREATURE_SCULPTOR:strcat(str,"Sculptor");break;
      case CREATURE_DANCER:strcat(str,"Dancer");break;
      case CREATURE_PHOTOGRAPHER:strcat(str,"Photographer");break;
      case CREATURE_CAMERAMAN:strcat(str,"Cameraman");break;
      case CREATURE_HAIRSTYLIST:strcat(str,"Hairstylist");break;
      case CREATURE_FASHIONDESIGNER:strcat(str,"Fashion Designer");break;
      case CREATURE_CLERK:strcat(str,"Clerk");break;
      case CREATURE_THIEF:strcat(str,"Professional Thief");break;
      case CREATURE_ACTOR:strcat(str,"Actor");break;
      case CREATURE_YOGAINSTRUCTOR:strcat(str,"Yoga Instructor");break;
      case CREATURE_MARTIALARTIST:strcat(str,"Black Belt");break;
      case CREATURE_ATHLETE:strcat(str,"Athlete");break;
      case CREATURE_TEENAGER:strcat(str,"Teenager");break;
      case CREATURE_PRISONER:strcat(str,"Prisoner");break;
      case CREATURE_DOCTOR:strcat(str,"Doctor");break;
      case CREATURE_PSYCHOLOGIST:strcat(str,"Psychologist");break;
      case CREATURE_NURSE:strcat(str,"Nurse");break;
      case CREATURE_LOCKSMITH:strcat(str,"Locksmith");break;
      case CREATURE_MILITARYPOLICE:strcat(str,"Military Police");break;
      case CREATURE_MILITARYOFFICER:strcat(str,"Military Officer");break;
      case CREATURE_SEAL:strcat(str,"Navy SEAL");break;
      case CREATURE_BANK_TELLER:strcat(str,"Bank Teller");break;
      case CREATURE_BANK_MANAGER:strcat(str,"Bank Manager");break;
      case CREATURE_GUARDDOG:strcat(str,"Canine Hero");break;
      case CREATURE_GENETIC:strcat(str,"Genetic Monster");break;
      case CREATURE_TANK:strcat(str,"M1 Abrams Tank");break;
      case CREATURE_CCS_MOLOTOV:strcat(str,"Arsonist");break;
      case CREATURE_CCS_SNIPER:strcat(str,"Sniper");break;
      case CREATURE_CCS_VIGILANTE:strcat(str,"Vigilante");break;
      case CREATURE_CCS_ARCHCONSERVATIVE:strcat(str,"CCS Officer");break;
      case CREATURE_POLITICALACTIVIST:strcat(str,"Political Activist");break;
      case CREATURE_SECRET_SERVICE:strcat(str,"Secret Service");break;
      default:
         strcat(str,"Liberal");
         break;
   }
}

The only difference from the previous code is the addition of the one line of code
Code: [Select]
      case CREATURE_SECRET_SERVICE:strcat(str,"Secret Service");break;
into the function. It actually doesn't matter where in the list it is, as long as it comes before the last item, the default, which HAS to be last (I am sure all the other programmers here know that already though). I put it in as the last one before default but if you'd rather move it elsewhere in the list that would work just as well, it doesn't matter, as long as it's in the list, which it wasn't before. So this is yet another bugfix from me (my username on SourceForge is "yetisyny" if you want to add me to the project so that I can commit bugfixes to the project directly instead of posting them on the forums, BTW).
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Fixes for Code::Blocks IDE
« Reply #4 on: August 04, 2013, 05:00:45 pm »

Hey, you should be added to the project and given commit rights, and thank you! I love it when people deal with issues that I've missed, and what I really love is when you make it easy on me and I don't have to manually apply changes other people make. ;)

The only difference from the previous code is the addition of the one line of code
Code: [Select]
      case CREATURE_SECRET_SERVICE:strcat(str,"Secret Service");break;
into the function. It actually doesn't matter where in the list it is, as long as it comes before the last item, the default, which HAS to be last (I am sure all the other programmers here know that already though). I put it in as the last one before default but if you'd rather move it elsewhere in the list that would work just as well, it doesn't matter, as long as it's in the list, which it wasn't before.

Thanks for catching this. It really doesn't matter where it is, don't sweat it.

Default doesn't actually have to be last, it just makes intuitive sense that way. It is occasionally useful to have a default earlier in the switch statement: If you leave the final break statement off of any of the cases or the default, they'll "fall through" and execute the commands of the next case as well. If you want the default to do a bit of code and then act like one of the other cases, you can do...

Code: [Select]
switch(myBreakfast)
{
default:
   // Mmm! My meal looks delicious!
   // (fall through)
case GREASE_CAKED_SOMETHING: // Skip the delicious part, these sound gross
case GREEN_EGGS_AND_HAM:
   // I eat until I am full.
   break;
case NOTHING:
   // I am a sad panda. :'(
   break;
}

If you were taught to always put the default case last, that isn't a bad thing. But it's a code quality mandate rather than a requirement of the language.

Well it turns out the reason for this, in the source code, happens to be the source code for when you steal things in apartments... what a coincidence! Anyway, it's a very obvious bug in the code. Basically there are arrays of possible items it could be, and LCSrandom() is called, yet the parameter for LCSrandom() is a higher number than the array size, meaning that sometimes, the array size will be exceeded, which, of course, is something that crashes a program in C++.

Cool, thanks for catching this, and in two different cases.

Previously, initfile.cpp didn't remove whitespace (spaces and tabs) before or after the text in each line of the init.txt file that was being parsed. Now it does, so if you have spaces or tabs to the left or right of the various lines (currently the 2 variables that get specified in that file are called "pagekeys" and "autosave"), now those spaces and tabs get ignored and initfile.cpp correctly parses them. In addition, it used to check for "off", "0", or "false" for the "autosave", but not "no". I have added a check for the word "no" (so now it checks for "off", "0", "false", or "no").

Thanks for fixing this.

I have noticed that if I compile Liberal Crime Squad in Code::Blocks with the compiler optimizations all enabled (like I did in the modified "game.cbp" file that is posted in my previous post), the game goes through computationally intensive tasks like many days going by and processing every event that happens, it does this all MUCH faster than in the 4.07.3 beta build downloadable from Jonathan S. Fox's website. Yes, it makes the game run MUCH faster. It's really awesome.

Neat; I usually end up releasing debug builds since they give marginally better bug reports and tend to crash sooner when there's a game breaking bug, which helps to ensure you don't corrupt your game by running over an array and writing all over memory without the game noticing. But if it makes a very noticeable difference in the speed of certain parts of the game, I'll look into turning on/up the amount of compiler optimization when I do releases in the future.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
New option for Random Number Generator
« Reply #5 on: August 07, 2013, 06:42:40 pm »

Neat; I usually end up releasing debug builds since they give marginally better bug reports and tend to crash sooner when there's a game breaking bug, which helps to ensure you don't corrupt your game by running over an array and writing all over memory without the game noticing. But if it makes a very noticeable difference in the speed of certain parts of the game, I'll look into turning on/up the amount of compiler optimization when I do releases in the future.

Thanks for all the wonderful feedback, I really appreciate it! I think once all these bug fixes are committed, maybe it would be a good time for you to put out a new beta version that has them all included. I'm sure the game probably still has some bugs (probably mostly minor things that I wouldn't notice when I play the game) but I've managed to squash several major ones. I do have some ideas on things to add to the game but for now I'm focusing on bug fixes, although I have run out of bugs that I've noticed, at least for now.

Anyway, when I compile and build the game in Code::Blocks (using GCC as the compiler), the Release build of the game is the usual size, the same as what you release, 2.15 megabytes, but the Debug build of the game is 12.4 megabytes. If you have been releasing Debug builds to the public, perhaps they have been Debug builds made in Microsoft Visual C++ rather than Code::Blocks with the GCC compiler, because creating Debug builds with the GCC compiler results in a very large file size. I have also read that, for most software projects at least, Debug builds are typically just used by developers, while Release builds are what is released to end users. Also, the traditional practice, at least with the GCC compiler, is to disable all compiler optimizations for Debug builds, because, while compiler optimizations make the game faster and the file size smaller, they make it harder for debuggers to trace things, and debuggers have the easiest time of it if all compiler optimizations are turned off. One example of why is, sometimes function calls are removed and the code from a function is inserted into the code of whatever calls the function, when you have compiler optimizations all turned on. That makes things much harder for debuggers, but it also increases the speed of programs significantly, it is basically a tradeoff.

One last thing, I have experimented with a change to the Random Number Generator that would make it stop being deterministic (the Random Number Generator seed is even stored in the save game file, so when you start the game, it loads the previous seed, making everything that happens in the game actually be deterministic, and the seed is only randomized once, when you first start a new game). My change makes it completely random all the time, and I've tested it and it works. However, I'm not sure whether or not you'd approve of this change. So I made it a new setting in init.txt that can be toggled on or off, and is off by default (so by default, everything is deterministic after the RNG is randomized once at the beginning of a new game). I'm not sure if you'd approve of this though, since it appears that the Random Number Generator being deterministic is by design and was done that way on purpose.

Anyway, here is the code that adds an option to init.txt to optionally make the Random Number Generator more random (again, not sure whether or not you'd approve of this):

New line added to "externs.h", right after the line that says "extern bool autosave;":
Code: [Select]
extern bool morerandom;

New line added to "game.cpp", right after the line that says "bool autosave=true;":
Code: [Select]
bool morerandom=false;

Changed code for function r_num() in "game.cpp":
Code: [Select]
//sets seed to a random number from 0 to 2 billion
int r_num(void)
{
   seed=((seed+morerandom*getSeed())*907725L+99979777UL)%2147483648UL;
   return seed;
}

Changed code for function setconfigoption() in "title\initfile.cpp":
Code: [Select]
void setconfigoption(string name, string value)
{
   transform(name.begin(), name.end(), name.begin(), ::tolower);
   transform(value.begin(), value.end(), value.begin(), ::tolower);
   if(name == "pagekeys")
   {
      if(value == "azerty")
      {
         interface_pgup='.';
         interface_pgdn='/';
      }
      else if(value == "brackets")
      {
         interface_pgup='[';
         interface_pgdn=']';
      }
      else if(value == "page")
      {
         interface_pgup=-61;
         interface_pgdn=-55;
      }
   }
   else if(name == "autosave")
   {
      if((value == "off") or (value == "0") or (value == "false") or (value == "no"))
         autosave=false;
   }
   else if(name == "random")
   {
      if((value == "on") or (value == "1") or (value == "true") or (value == "yes"))
         morerandom=true;
   }
}

Changed text for configuration file "init.txt":
Code: [Select]
#####################################################################
#####################################################################
##                                                                 ##
##           Configuration File for Liberal Crime Squad            ##
##                                                                 ##
#####################################################################
#####################################################################

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

#Leave this to use [ and ] to page through menus
    pagekeys=brackets

#Uncomment to use . and / and add other AZERTY keyboard improvements
    #pagekeys=AZERTY

#Uncomment to use PGUP and PGDOWN (doesn't work for many people)
    #pagekeys=page

#Uncomment this to disable saving between days
    #autosave=Off

#Uncomment this to make the random number generator more random
    #random=On

So those are the changes required to make the option to make the random number generator more random (a change that is still off by default). The real trick I did is in the function r_num(), in the line "seed=((seed+morerandom*getSeed())*907725L+99979777UL)%2147483648UL;". The variable morerandom is a C++ bool type, which is 0 for false or 1 for true. So if you multiply it by any integer type, you get 0 if it's false, while you get the number you're multiplying it by if it's true. The old code for that line is "seed=(seed*907725L+99979777UL)%2147483648UL;". The new code behaves exactly the same as the old code if morerandom is false, since false is treated as 0 in C++. This way I don't have to do an if-then-else statement, and can keep that particular change to r_num() as a single line of code. Oh yeah, and this whole thing relies upon my previous changes to init.txt to improve the parsing of whitespace. Obviously, to test out my more random version of the random number generator, you'd uncomment the "random=On" line in the new version of init.txt, since it's off by default.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
All changes committed to revison 694
« Reply #6 on: August 07, 2013, 11:10:08 pm »

Ah, I noticed that Jonathan S. Fox has given me commit access to the project. Thank you very much! OK, all the changes from my posts in this thread have been committed to the project, as a new revision, revision 694.

https://sourceforge.net/p/lcsgame/code/694/

If you are NOT a programmer, you can still take advantage of these changes. Go to https://sourceforge.net/p/lcsgame/code/694/tarball to download it as a .zip file. Create a new empty directory somewhere. Extract the "init.txt" file, the "art" directory, the "pdcurses.dll" from the "workspaces" directory, and the "crimesquad.exe" file from the "workspaces\Release" directory all into that same directory. Now you can play Liberal Crime Squad SVN revision 694!

Anyway, this should probably be released to everyone as a bugfix release. Since 4.07.3a was a bugfix release based on 4.07.3, and this is a bugfix release based on 4.07.3a, I am guessing the version number for this should be 4.07.3b. Or 4.07.4 maybe. Anyway, I think it should be released as a bugfix release now that these changes are committed.
« Last Edit: August 08, 2013, 12:23:52 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Fixes for Code::Blocks IDE
« Reply #7 on: August 08, 2013, 05:02:05 am »

Fixed MANY bugs since revision 694.

In revision 695, I fixed an infinite-money bug where you could buy Combat Knives for $20 and sell them for $30 at the Pawnshop (my fix was simply to switch those 2 prices around, now a Combat Knife costs $30 to buy and you can sell it for $20), plus also put in the text "Done buying Liberal tools" for when you're done buying Liberal tools (it was "Leave" before, which was, quite simply, wrong). This involved editing 2 files in the "art" directory: "pawnshop.xml" and "weapons.xml".

In revision 696, I fixed some bugs in "reviewmode.cpp" in the "basemode" directory. It used to be that you could have someone's boss kill them, even if the boss was at another location (such as in jail or in another city). Now your boss can only kill you if you're at the same place. Another fix was, if you release someone from the Liberal Crime Squad and they rat out their boss, then if their boss happens to be someplace like jail or a clinic, the jail or clinic gets heat on it and possibly set up for a siege, rather than having the heat and/or siege go to the boss's base (the place they live at when they aren't in a clinic, hospital, or jail).

In revision 697, I fixed a bug where if one of your Liberals went to a different city but had meetings and/or dates scheduled with people in their previous city, they would still be able to continue meeting with and dating people in the old city while simultaneously being in the new city (this was in "daily.cpp" in the "daily" directory). Now, when a Liberal moves to a different city, all their existing meetings and dates are canceled.

In revision 698, I fixed a bug where it didn't display the full name of each location (namely, it left out the city at the end) when you were in the moving equipment screen that lets you move equipment between bases. So now you can tell which city's Shelter your equipment is at, if it's at a Shelter, for instance. This was in "equipment.cpp" in the "common" directory.

In revision 699, I added display of the current city to site mode and to dates. Also, since there is so much horizontal room in the top line of the screen in site mode, it displays the full name of the city in site mode, not just a 3-letter abbreviation like everywhere else. There was also an oversight of "locations.h" being left out of the Code::Blocks project, but I added it. A new thing is that when you talk to someone at a site, the color of their alignment is shown on the screen where you get a list of options to say (that bright red color reminds you not to accidentally talk to Conservatives about the issues, whereas when it's bright green, you're good to go). An old bug with the skills at the top of the screen not being listed in the correct order was fixed (they've always been listed in the correct order on the "Profile of a Liberal" page, so the relevant bit of that code was reused to make sure the skills would be in the right order on the top of the screen, too). Files in the source code modified in this revision are numerous: the Code::Blocks project file "game.cbp" in the "workspaces" directory, "commondisplay.cpp" in the "common" directory, both "locations.cpp" and "locations.h" in the "locations" directory, "date.cpp" in the "daily" directory, and both "sitemode.cpp" and "talk.cpp" in the "sitemode" directory. And of course I've compiled new binaries of both the Release and Debug builds of "crimesquad.exe", as with the previous revisions I uploaded.

In revision 700, I alphabetized the list of skills in "creature.h", so that when you look at the Profile of a Liberal and press up or down to see all the skills, they'll be in alphabetical order (and of course compiled and built it into Release and Debug builds of "crimesquad.exe" again).

In revision 701, I alphabetized the list of crimes in "includes.h", so that when you look at the Profile of a Liberal and press up or down to see all the crimes they committed, they'll also be in alphabetical order too. And I compiled both builds, yet again.

In revision 702, I improved location name handling even further than the improvements in revision 699, replaced the word "and" with the symbol "&" in "Brookyn and Queens" and "Outskirts and Orange County", and gave Washington DC a city description ("The Nation's Capital."). The most obvious changes are if you press "F" on the main screen to go forth to different parts of cities in multiple-city mode, or if you look at your list of sleepers in multiple-city mode and look at the ones whose location is a city itself rather than a place IN a city. None of these changes in revision 702 affect single-city mode, it's all to do with location names in multiple-city mode.

In revision 703, I added Residential Bomb Shelter (CCS Hideout #2) and Outdoor Bunker (CCS Hideout #3) back to single-city mode, since they were missing from single-city mode for some reason, making it impossible to defeat the CCS through the usual method of taking over all 3 CCS hideouts in single-city mode.

In revision 704, I fixed the option during character creation to start out with maps of several sites downtown (although the downtown sites didn't inherit the "mapped" property from the downtown district like they ought to so I had to set it manually for every single one of them, which is another bug that needs to be fixed in the future, because new locations are supposed to inherit the "mapped" property and several other properties from their parent location, but that seems to be broken). Getting maps of the downtown sites works the same as before for single-city mode, and for multiple-city mode, it applies only to your starting city of Seattle. The starting gender is now randomly either male or female, with the opposite gender as the 2nd option and intersex as the 3rd option (it used to be that female was always the starting gender, male was the 2nd option, and intersex was the 3rd option). Gun control laws were set twice when starting a new game while prison laws weren't set at all; this has been fixed, now each type of law is set exactly once. The "PDA" item has been renamed to "Tablet" since tablets such as iPads and other brands of tablets are very popular and common now, while nobody uses PDAs anymore now that smartphones and tablets can fulfill all their duties and more (however, only the display name was changed from "PDA" to "Tablet"; the internal name of "LOOT_PDA" was kept the same for compatibility reasons).

In revision 705, I removed the option to re-seed the Random Number Generator every time it's used from "init.txt", as per Jonathan S. Fox's advice not to allow end users to use such a feature as they could abuse it for cheating and it might impede debugging. It has been changed to a commented-out "#define" compiler flag in "includes.h" so that this option may only be used for debugging purposes.

In revision 706, I fixed a bug with the game getting Liberals and Conservatives mixed up after someone counterattacks in a fight for the rest of that round of fighting (due to the boolean variable "goodguyattack" getting toggled once before the counterattack but not getting toggled back again afterwards). This was in "fight.cpp" in the "combat" directory.

In revision 707, I fixed statename() in "misc.cpp" to behave the way it should and not just return random results all the time. This enables getting the correct names of states with numbers in the range 0 to 49. Calling it with a random number such as -1 is how to get a random state's name. Fixed bug with Vermont always voting "Nay" on Constitutional amendments (it was supposed to be Utah, not Vermont, and this didn't take into account Arch-Conservative amendments, which a state like Utah would approve of). Improved month-name handling so that when you get a 4-character abbreviation, you get "May", "June", or "July", rather than "May." (note the period), "Jun.", or "Jul.", by adding a new getmonth() function. Improved a bit in "fight.cpp" where someone injured would either call out "Mommy!" or "What about my children?"... now, humans under age 20 call out "Mommy!", humans age 20 or older (along with tanks) ask "What about my children?", dogs ask "What about my puppies?", and genetic monsters ask "What about my offspring?".

In revision 708, I switched over the 1 last place where month names were not obtained by the new getmonth() function. This really should have been part of revision 707, it was an accidental oversight not to include it.

In revision 709, I put in proper bias numbers for all 50 states for Constitutional amendments into "endgame.cpp" in the "monthly" directory. This made it harder to pass amendments (less "Yea" votes than before), so I made another minor modification so that half the time, you only need 3 out of the 4 votes to go the right way in a state to get a "Yea" vote. Now the amount of "Yea" and "Nay" votes is about the same as prior to my bias adjustments. However, you'll notice that the states that tend to object to Elite Liberal amendments are usually right-wing states, while the states that tend to object to Arch-Conservative amendments are usually left-wing states. This makes for a more accurate representation of the polarization between red and blue states. Each state has a bias number from -6 (Utah only) to +6 (Massachusetts only). The 5 swing states of Colorado, Florida, Nevada, Ohio, and Virginia are the only states with no bias either way (bias of 0). For all other states besides the 7 I mentioned, they are biased by an amount from 1 to 5 in either the Liberal or Conservative direction. I based my bias numbers on analysis of polling data, the election results for all Presidential elections between 1988 and 2012 (with much greater emphasis on more recent elections), and a bit of subjective tinkering based on my personal opinions of how Liberal or Conservative each state is (which are fairly accurate opinions, as I have done plenty of reading of Nate Silver's FiveThirtyEight blog and followed election results for years). A bias of 1 in either direction indicates the state only slightly leans that direction and could go the other way relatively easily. A bias of 2 in either direction indicates the state is more strongly biased in a direction, but could still occasionally go the other way in a Presidential election. A bias of 3 in either direction indicates it is a solidly red or blue state that would probably only go the other way in a blowout election (think 1984 or 1964). A bias of 4 in either direction indicates a state that would probably stay Liberal or Conservative in a blowout election, too (but not 100% guaranteed). A bias of 5 in either direction indicates a state that is pretty much 100% guaranteed to go a certain direction no matter what. A bias of 6 in either direction is a rare honor reserved for the most Arch-Conservative and most Elite Liberal states in the Union, Utah and Massachusetts, respectively. And of course states with a bias of 0 have the same exact views as the nation at large and are not biased at all.

In revision 710, I fixed a bug where sometimes money would end up as an item in your inventory at a base, rather than properly being added to the amount of money you have and removed as an item, adding a new function called getloot() to "location.cpp" in the "location" directory for standardized transfer of loot to a base with proper handling of money.

In revision 711, I just did a very very minor layout fix, wrong indentation in one line of code that I wrote in the previous revision, not even worth mentioning.

In revision 712, I fixed an infinite-loop bug if you tried building more than 5 business fronts, by increasing the number of different business front possibilities from 5 to 28, and fixed another related infinite-loop bug with homeless shelters. I also fixed the layout and formatting of dealership() in shopsnstuff.cpp, the function where sleeper car salesmen do their stuff. I also made it so sleeper car salesmen can only get you discounts in the same city as them, sleeper police and firemen only warn you about raids in the same city as them (since each city has separate police and fire services from other cities), and sleeper judges and lawyers can only help you out if your trial is in the same city as them. However, sleeper CEOs, CCS vigilantes, and CIA Agents can still warn you about raids in other cities, since all their organizations operate nationally or internationally and have lots of information-sharing, so it would make perfect sense for a CIA Agent in one city to warn you about a CIA raid on one of your hideouts in another city. But not with police or firemen, they operate at the local level, every city has a separate police department and fire department from other cities. There are 2 more fixes for trials: a person whose base was no longer being rented would get moved to any old homeless shelter, rather than the homeless shelter in the same city as them, and sleeper judges were supposed to prevent confessions by former LCS members who betrayed you. Now both those things are fixed, and if your base is no longer rented by the LCS, you end up at the homeless shelter in the same city where your trial happened, and a sleeper judge really does now prevent confessions.

Revision 713 has a LONG list of changes, here it is:
  • Enabled "Praying won't help you now!" threat in talk.cpp by changing LCSrandom(3) to LCSrandom(4), fixed "Nobeast" typo in talk.cpp to "No beast".
  • Set default thing to teach other Liberals (Fighting, Covert Ops, or Politics) for all Creature types in activate.cpp.
  • New ultra-awesome Elite Liberal issue text for all the issues if you bring the country to Elite Liberal status (i.e., win the game in No Compromise Classic Mode where all laws must be Elite Liberal rather than Democrat Mode) in liberalagenda.cpp.
  • Removed Political Activists from list of creature types in sleeper_update.cpp with no effect when advocating Liberalism as Sleepers (Political Activist Sleepers occur when Teenager Sleepers turn 18 years old, and it would be reasonable to assume that the longer someone is a Sleeper, the more effective they get, which was the opposite of what happened to Teenager Sleepers who turned 18). Now Political Activist Sleepers have the same amount of effect as Teenager Sleepers, no more, no less.
  • Also made Politicians super Sleepers like Eminent Scientists and Corporate CEOs, also in sleeper_update.cpp, with a power multiplier of 20, plus Politician Sleepers now affect 3 random non-media/LCS/CCS issues (using VIEWNUM-5), plus they have enhanced embezzlement abilities and can leak intelligence documents.
  • Fixed finding of homeless shelter (a.k.a. SITE_RESIDENTIAL_SHELTER) to always use find_homeless_shelter() so that it would find one in the same city, rather than the first one (which would always be Seattle in multi-city mode) (this fix was done in many different places in different files).
  • Updated locations.h so that the sites are in a proper order (there are checks made in various parts of the code to see if getting a site mapped is useless, and those are done by seeing if the site's type <= SITE_RESIDENTIAL_SHELTER, so there needed to be a slight rearrangement so that those checks would return correct results).
  • Maxed-out skills now show as cyan not just in the "Profile of a Liberal" status pages but also in the smaller display on the top of the screen most of the time.
  • Second-in-command to a King is a Chancellor, not a Vice President (if you lose and the country is Reaganified... and my info on Chancellor being second highest ranking comes from the game Chrono Trigger).
  • Added and used a find_courthouse() similar to the ones for homeless shelter, police station, and clinic, so Court Houses would be in the same city too (hopefully it'll be working so that the entire justice system, from arrest to police station to courthouse to prison to being released at the homeless shelter, all stays in the same city, but of course this means every city needs to have a homeless shelter, police station, courthouse, and prison, or else the game will have errors).
  • Crack Head renamed to Crackhead, and Court House renamed to Courthouse. Firefighter, Cable News Anchor, Liberal Judge, and Hangin' Judge have those names consistently (a sleeper Hangin' Judge is WAY more effective than a sleeper Liberal Judge, now it's easier to tell them apart once they've joined the LCS).
  • Socialite clothing now depends on gender instead of being random (resulting in clothes for wrong gender half the time). That is just part of extensive code cleanup in getnames.cpp and creaturetypes.cpp (creaturetypes.cpp had WAY too many lines of code, I made it more compact using various tricks like conditionals instead of if...else statements and it should still work fine).
  • Instead of picking a type of work site that might not exist in the current city (e.g. Lawyers can work in the White House but only Washington DC has a White House so a Lawyer in a different city wanting to work at a White House is gonna run into some problems), now verifyworklocation() picks randomly from all acceptable work locations in the current city (so a Lawyer would be willing to settle for a Courthouse instead).
  • Shorter short name for Used Car Dealership (it was WAY too long in multi-city mode, now the short name is just "Used Cars" like it should be).
  • Improved PNG compression for siteblocks.png & specials.png (the images are identical, just smaller file size).

Revision 714 changes:
  • "Cellphone" renamed to "Smartphone" in loot.xml. (Cell Phone is usually spelled with 2 words instead of 1, however nowadays the word "Smartphone" is usually used for iPhones, Android phones, and other more advanced phones, and it is still a single word. And the LCS, if it stole cell phones, would most likely try to steal smartphones since they're more valuable. However, I didn't increase the price, since prices for electronics fall rapidly, especially used electronics, and they're always coming out with new models, so all I changed was the name.)
  • New hisher() function for Creatures, similar to heshe(), implemented and put into wide use.
  • More complex handling of drug overdoses of hostages during interrogation, look at the changes to interrogation.cpp for details. Basically if nobody in the interrogation team has First Aid skill, then any overdose of drugs that would have previously led to a decrease of health by 1 now leads to death. But if someone in the interrogation team has very high First Aid skill, then drug overdoses don't do any health damage at all. If there's someone with First Aid skill but it's not very high, there is a decrease of health by 1 just as before. The details are a bit more complicated but those are the basics.
  • Several occurrences of "addstr(something), gamelog;" fixed to "addstr(something, gamelog);"

Revision 715 changes:
The new function init_console() is now run at the beginning of the game, initializing which code page the console uses, and it should work cross-platform. The main thing this fixes is, now users of non-U.S. English versions of Windows will have the correct extended characters displayed as long as they are using a TrueType font like Lucida Console for their console display, rather than using raster fonts (all of which are variants of Terminal). If users of non-U.S. English versions of Windows wish to have the correct extended characters also be displayed even when using raster fonts in a console window, this can only be done by changing a setting in Control Panel. Specifically, under International and Language Settings, you change the Default Language for Non-Unicode Applications to be U.S. English, Code Page 437, the standard code page that IBM developed for DOS versions in the United States, which also happens to be the code page that Liberal Crime Squad uses. For international users of Windows who do not want to mess with Control Panel settings, simply set the font for your console window of Liberal Crime Squad to Lucida Console (any size works) and you'll be good to go. As for users of other operating systems such as Linux and Mac OS X, more testing and feedback is needed on whether the proper characters are displayed on the screen.

Yep... take a look at the history, good stuff: https://sourceforge.net/p/lcsgame/code/log/
« Last Edit: August 21, 2013, 11:14:04 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Darvi

  • Bay Watcher
  • <Cript> Darvi is my wifi.
    • View Profile
Re: Fixes for Code::Blocks IDE
« Reply #8 on: August 08, 2013, 05:18:46 am »

I read that as "infinite-monkey".
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Fixes for Code::Blocks IDE
« Reply #9 on: August 08, 2013, 08:12:10 am »

I read that as "infinite-monkey".

That is correct. An infinite number of monkeys on an infinite amount of typewriters can easily make an infinite amount of money. Even if the average monkey only makes 1 cent, the fact that there's an infinite number of monkeys makes the amount of money the monkeys get infinite. Needless to say, a drastic increase in the money supply to the point where money becomes infinite would lead to hyperinflation. For more information on infinite monkeys, infinite money, and hyperinflation, please consult a Zimbabwean economist or ecologist (or econogist or ecolomist... an econogist is a cross between a male economist and a female ecologist, while an ecolomist is a cross between a male ecologist and a female economist).
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: New option for Random Number Generator
« Reply #10 on: August 09, 2013, 05:47:16 pm »

If you have been releasing Debug builds to the public, perhaps they have been Debug builds made in Microsoft Visual C++ rather than Code::Blocks with the GCC compiler, because creating Debug builds with the GCC compiler results in a very large file size. I have also read that, for most software projects at least, Debug builds are typically just used by developers, while Release builds are what is released to end users. Also, the traditional practice, at least with the GCC compiler, is to disable all compiler optimizations for Debug builds, because, while compiler optimizations make the game faster and the file size smaller, they make it harder for debuggers to trace things, and debuggers have the easiest time of it if all compiler optimizations are turned off.

Yes, I've been doing it with MSVC++ debug builds, not compiled with GCC. The release builds are a bit smaller.

It's true that normally you do release builds for public releases (which is why they're so named). However, this generally involves much more internal testing. I'm unable to do anything but just play the game myself, and I miss a lot of bugs. In practice, the general public is the testing group for LCS, and releasing debug builds makes it easier to track down bugs people run into.

And yes, turning on optimizations would probably involve doing release builds rather than debug builds.

One last thing, I have experimented with a change to the Random Number Generator that would make it stop being deterministic [...] I'm not sure if you'd approve of this though, since it appears that the Random Number Generator being deterministic is by design and was done that way on purpose.

RNGs in computers are just math functions that take one number and produce another seemingly unrelated number. They aren't random; they're just so chaotic in their mapping that they are effectively random. The way they typically work is that you use the previous randomly generated number as the seed (or input) for the next one. To get the initial seed, you draw on something like the current time.

One side effect of using the output of the function to seed the next call of it is that the RNG produces deterministic sequences, where every roll precisely predicts the next one. Since the function is producing numbers anywhere in the range of billions of numbers, you'll never notice this happening; it's pure random as far as the player is concerned. The only impact it really has is that it allows you to reproduce the same random rolls if you save the seed at some point and reuse that seed. There are a couple cases where this is useful.

1) Procedurally generated content can be stored by saving only the seed used by the RNG when generating the content. For example, many of the buildings in LCS are consistent in their layout with every visit, even though they're randomly laid out, and their layout isn't stored in memory anywhere. This is because we store the seed used to generate the building, and use it each time, relying on the deterministic nature of the RNG to produce the same building. When we want to generate a different building, we just change the initial seed, and we get a new building. If we want to let the player alter a building, like spraypainting a wall, all we need to do is store a list of the changes made (eg, at coordinates 5x17 the player sprayed tags on the walls), and then apply those changes after regenerating the map.

2) Repeatable bugs that rely on random factors. Sometimes people will give bug reports with a save, and instructions like "go to this location, walk three steps down, one step right, press fight, and the game crashes." This is only possible if you're following the same sequence of RNG rolls with each play, since otherwise the fight would play out differently and different enemies would appear in a different place.

3) Minimize the benefit of savescumming. This isn't as relevant for LCS, but in a game like Civilization, keeping the RNG from producing different rolls when you save and load will ensure that the player can't just save before a really low odds fight, try it, load when it goes badly, fight again, load again, and repeat this exercise until they win the battle by sheer dumb luck. The save/load process is cheating, and more importantly, it's not fun for most people. If it can be done, many people will do it, despite it being a frustrating and slow process. With the seed saved alongside the game state, this trick doesn't work, so people won't be tempted to torture themselves by trying to use it. (You can savescum and make different choices, but you can't do it just to cheese the RNG.)

For these reasons, it is standard and best practice to keep the RNG seeding itself based purely on the results of the last roll. That doesn't mean it's any less random than otherwise; in truth, the approach you're taking is deterministic as well, it's just that successive rolls are determined not only by the previous rolls, but also on the time that the previous rolls were made, which is an uncontrollable factor. That doesn't make the results more random (time is no more truly random than the results of the last RNG roll), but it does mean you're "salting" the generator with external factors that prevent you from repeating the same sequence of rolls twice. Since repeatable sequences is actually a really useful thing, it's best to let the generator reseed itself purely based on the results of previous rolls.

In revision 697, I fixed a bug where if one of your Liberals went to a different city but had meetings and/or dates scheduled with people in their previous city, they would still be able to continue meeting with and dating people in the old city while simultaneously being in the new city (this was in "daily.cpp" in the "daily" directory). Now, when a Liberal moves to a different city, all their existing meetings and dates are canceled.

In revision 698, I fixed a bug where it didn't display the full name of each location (namely, it left out the city at the end) when you were in the moving equipment screen that lets you move equipment between bases. So now you can tell which city's Shelter your equipment is at, if it's at a Shelter, for instance. This was in "equipment.cpp" in the "common" directory.

Thanks for shoring up some of the National LCS stuff! These features aren't truly finished, but you're helping to get them closer to done.

In revision 699, I added display of the current city to site mode and to dates. Also, since there is so much horizontal room in the top line of the screen in site mode, it displays the full name of the city in site mode, not just a 3-letter abbreviation like everywhere else.

I'd just make sure that space isn't needed for the "conservative response incoming" notifications at the top of the screen. They only display some of the time, and they take up a lot of space in that area!

In revision 700, I alphabetized the list of skills in "creature.h", so that when you look at the Profile of a Liberal and press up or down to see all the skills, they'll be in alphabetical order (and of course compiled and built it into Release and Debug builds of "crimesquad.exe" again).

In revision 701, I alphabetized the list of crimes in "includes.h", so that when you look at the Profile of a Liberal and press up or down to see all the crimes they committed, they'll also be in alphabetical order too. And I compiled both builds, yet again.

I'm not sure if this is an improvement or not; I see benefits and drawbacks. The skills in particular were in a sort of loose logical order, so combat skills were clustered together on the skills screen, for example. Alphabetized will make it easier to look up specific skills you're interested in, but removes any spacial grouping of skills on the screen.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Fixes for Code::Blocks IDE
« Reply #11 on: August 10, 2013, 07:18:44 pm »

Yes, I've been doing it with MSVC++ debug builds, not compiled with GCC. The release builds are a bit smaller.

It's true that normally you do release builds for public releases (which is why they're so named). However, this generally involves much more internal testing. I'm unable to do anything but just play the game myself, and I miss a lot of bugs. In practice, the general public is the testing group for LCS, and releasing debug builds makes it easier to track down bugs people run into.

And yes, turning on optimizations would probably involve doing release builds rather than debug builds.
Debug builds from GCC aren't very good compared to MSVC++ debug builds. They are slower and have a MUCH larger file size (12.4 megabytes versus 2.something megabytes in the case of Liberal Crime Squad). However, release builds from GCC have a nice small file size and run fast. Anyway, I think it's best if all the public releases continue to be MSVC++ debug builds like the ones you have made in the past, since they can do debugging and are comparable in size to release builds, and reasonably fast (not as fast as release builds from either compiler, but much faster than debug builds from GCC). From what I've read, release builds from MSVC++ are even faster than release builds from GCC, since M$ has loads more compiler optimizations than GCC, so the only reason my GCC release builds run faster than your MSVC++ debug builds is that release builds are always faster than debug builds. Still, it's good that the game is compatible with both compilers, since GCC works on Linux / Mac OS X / etc. and MSVC++ doesn't, but MSVC++ does seem to be better for making Windows binaries from what I've read, and from comparing the very large, very slow debug builds GCC produces to the smaller, faster ones you've been able to produce with MSVC++. Only certain optimizations work in debug builds; the newest version of GCC (version 4.8.1) has an option "-Og" for this. Unfortunately, that version of GCC isn't the one that comes with Code::Blocks and I am not sure if Code::Blocks is compatible with GCC 4.8.1, so I use the version of GCC that comes with Code::Blocks and is compatible with it (4.7.1, I think, rather than 4.8.1).

Anyway, code that compiles correctly in both GCC and MSVC++ is more likely to work properly and not have bugs than code that only works in 1 of those 2 compilers, so keeping Liberal Crime Squad working with both of them is definitely a good thing.

RNGs in computers are just math functions that take one number and produce another seemingly unrelated number. They aren't random; they're just so chaotic in their mapping that they are effectively random. The way they typically work is that you use the previous randomly generated number as the seed (or input) for the next one. To get the initial seed, you draw on something like the current time.

One side effect of using the output of the function to seed the next call of it is that the RNG produces deterministic sequences, where every roll precisely predicts the next one. Since the function is producing numbers anywhere in the range of billions of numbers, you'll never notice this happening; it's pure random as far as the player is concerned. The only impact it really has is that it allows you to reproduce the same random rolls if you save the seed at some point and reuse that seed. There are a couple cases where this is useful.

1) Procedurally generated content can be stored by saving only the seed used by the RNG when generating the content. For example, many of the buildings in LCS are consistent in their layout with every visit, even though they're randomly laid out, and their layout isn't stored in memory anywhere. This is because we store the seed used to generate the building, and use it each time, relying on the deterministic nature of the RNG to produce the same building. When we want to generate a different building, we just change the initial seed, and we get a new building. If we want to let the player alter a building, like spraypainting a wall, all we need to do is store a list of the changes made (eg, at coordinates 5x17 the player sprayed tags on the walls), and then apply those changes after regenerating the map.

2) Repeatable bugs that rely on random factors. Sometimes people will give bug reports with a save, and instructions like "go to this location, walk three steps down, one step right, press fight, and the game crashes." This is only possible if you're following the same sequence of RNG rolls with each play, since otherwise the fight would play out differently and different enemies would appear in a different place.

3) Minimize the benefit of savescumming. This isn't as relevant for LCS, but in a game like Civilization, keeping the RNG from producing different rolls when you save and load will ensure that the player can't just save before a really low odds fight, try it, load when it goes badly, fight again, load again, and repeat this exercise until they win the battle by sheer dumb luck. The save/load process is cheating, and more importantly, it's not fun for most people. If it can be done, many people will do it, despite it being a frustrating and slow process. With the seed saved alongside the game state, this trick doesn't work, so people won't be tempted to torture themselves by trying to use it. (You can savescum and make different choices, but you can't do it just to cheese the RNG.)

For these reasons, it is standard and best practice to keep the RNG seeding itself based purely on the results of the last roll. That doesn't mean it's any less random than otherwise; in truth, the approach you're taking is deterministic as well, it's just that successive rolls are determined not only by the previous rolls, but also on the time that the previous rolls were made, which is an uncontrollable factor. That doesn't make the results more random (time is no more truly random than the results of the last RNG roll), but it does mean you're "salting" the generator with external factors that prevent you from repeating the same sequence of rolls twice. Since repeatable sequences is actually a really useful thing, it's best to let the generator reseed itself purely based on the results of previous rolls.
Yes, I thought you might disapprove of the change to RNG seeding, which is why I made it optional and disabled by default, and only possible to enable via a setting in "init.txt". Since you don't like this feature being enabled for end users, I'm now removing it as an "init.txt" setting and changing it to a compiler flag that is disabled by default, one of the commented out #defines in "includes.h", which will address all of your concerns because end users will not ever have that setting enabled, and it will only be for debugging purposes.

Thanks for shoring up some of the National LCS stuff! These features aren't truly finished, but you're helping to get them closer to done.
Yes, this seems to be the area that probably needs the most work at the moment. I'll see what else I can do to get the National stuff more fully implemented.

I'd just make sure that space isn't needed for the "conservative response incoming" notifications at the top of the screen. They only display some of the time, and they take up a lot of space in that area!
Yes, I thoroughly tested that, and there aren't any problems with that. Those notices about Conservative responses don't take up THAT much space in site mode. There's a lot more space taken up at the top of the screen when you're at a hideout with all the options, or if you're on a date... in both of those cases there isn't much space at all in the top line for the name of the location you are at.

I'm not sure if {alphabetizing the lists of crimes and skills} is an improvement or not; I see benefits and drawbacks. The skills in particular were in a sort of loose logical order, so combat skills were clustered together on the skills screen, for example. Alphabetized will make it easier to look up specific skills you're interested in, but removes any spacial grouping of skills on the screen.
It's much easier to find things when they're in alphabetical order, at least for me. I could never figure out the reasoning behind the order of the skills or crimes. Grouping combat skills together makes sense, so does grouping skills together based on what their base attribute is (Strength, Charisma, Intelligence, Agility, Heart, etc.) Another order for crimes that might make sense is putting them in order of severity (either from most severe crime to most minor crime, or most minor crime to most severe crime). However I just went with alphabetical order, it's the simplest and easiest for people to find things in the list. Like if I am wondering "What is my Music skill?" I can go straight to the list of skills and it's right there in alphabetical order, easy to find.
« Last Edit: August 11, 2013, 12:14:20 am by Liberal Elitist »
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Fixes for Code::Blocks IDE
« Reply #12 on: August 14, 2013, 03:38:27 am »

I've been regularly updating my post that lists changes in this thread (click here to go up to it). Look at the changes all the way up thru revision 710 (the current one, as of the time I am posting this message).

So, what do people think? I think this game just keeps getting better and better, and it might be time for another beta release for everyone to try out (compiled in MSVC++ of course, since the Debug builds made by GCC are over 12 megabytes and way slower than MSVC++ Debug builds). After all, there have been a lot of bug fixes and enhancements made since the last beta release and I think it's a good time to release it to the users as another beta release so they can try it out and give their feedback.

Oh, and what else needs to be done before it can be stable? Implementing the multiple-city stuff more thoroughly, right? Have any specific ideas on what needs to be implemented in that area, like a TODO list or something? I could probably help if there were a specific list of things to implement regarding this multi-city mode. Maybe not very well with creating new locations that require maps, I don't quite understand how that part works (or a bunch of other things, like how reading XML files or playing ASCII movies work, those are pretty advanced parts of the code that I haven't messed with at all). But I'm good at fixing bugs and working with general parts of the code that aren't too advanced (which is MOST of the code).
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Fixes for Code::Blocks IDE
« Reply #13 on: August 21, 2013, 06:19:17 pm »

I want to advise you on your commit messages; from the most recent:

Quote
Windows XP and later have a font display option called ClearType, but ClearType has a bug in it that affects this game. When the ClearType feature is enabled, it causes display problems in Liberal Crime Squad as well as other Win32 Console Applications, especially if different background colors are used, if you are using a TrueType font like Lucida Console for the display of the game instead of a raster font. The bug in ClearType is visible on the screen as vertical lines in between characters on the screen. This is most visible on the newspaper screens, or if you are going back and forth from the main screen when the main screen has a U.S. flag on it, or especially in the colorful Curses text animations (new news anchor, show about rich and famous, caught on camera of black guy getting beaten, etc.). This bug can only be solved by disabling ClearType (since Microsoft obviously isn't going to offer any more non-security-related fixes for Windows XP). However, ClearType is useful in other programs and a lot of people like it. So, a good solution is to temporarily disable ClearType while Liberal Crime Squad is running, and then re-enable it after the game is over. Of course, people might not have it enabled; they might be using standard font smoothing instead or have font smoothing completely disabled. So, there is a new option in init.txt called "fixcleartype". If this is disabled (and it IS disabled by default), the game does not mess with ClearType or font smoothing settings at all. If it is enabled, the font smoothing settings are backed up when the game starts, and then the game switches Windows to use standard font smoothing, which works well with the TrueType font Lucida Console if you chose that for your console window, and has no effect if you are using a raster font. Then when you exit the game, the backed up settings are restored (so whatever your previous setting was, whether it was ClearType on, standard font smoothing on, or all font smoothing disabled, that previous setting gets restored). Additionally, since ClearType only exists in Windows XP and later, all of the ClearType-related code is ignored by the compiler on non-Win32 platforms such as Linux and Mac OS X, so this does not affect compatibility with those operating systems one bit. Furthermore, if you are on a Win32 operating system and have selected the "fixcleartype" option in init.txt, the game looks at your Windows version, and if it is older than Windows XP (version 5.1), all the ClearType-related code is disabled, to maintain compatibility with older versions of Windows. The only issue with the "fixcleartype" option is that, although the game only temporarily changes your font smoothing settings to be standard font smoothing, if the game crashes or if you terminate it in any way other than exiting through the game's keyboard interface, the code that restores your backed up font smoothing settings does not get executed. For this reason, "fixcleartype" is disabled by default. However, for users who choose a TrueType font like Lucida Console for the console display in Windows XP or later, the "fixcleartype" feature may prove to be a valuable workaround for the aforementioned bug in ClearType that Microsoft refuses to fix.

The bold text is the stuff you need most, and the thing anyone reading your notes are most looking for. If you do want to add an extensive discussion of the changes, make sure to put a summary of the actual changes at the top in summary, then separately, preferably with some whitespace in between, add the discussion and elaboration. Posting a wall of text with the actual changes buried in the middle makes it much more difficult for someone to skim over change logs to determine what has actually changed from version to version, which is what commit notes are supposed to convey.

Example much more brief commit message for the same change:

Quote
Added an init.txt option to tell Windows to use non-ClearType font smoothing

Enabling the init.txt option "fixcleartype" will cause the game to instruct Windows to use standard font smoothing instead of ClearType. This fixes a display bug with Windows' ClearType smoothing, in which TrueType fonts like Lucidia Console do not display correctly on some screens, showing vertical lines during full screen animations and in the newspaper. If the game exits correctly, it will revert the settings to the same as Windows had prior to the game starting up. This option is disabled by default and has no effect on other platforms, or older versions of Windows without ClearType.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Fixes for Code::Blocks IDE
« Reply #14 on: August 21, 2013, 07:01:49 pm »

Thanks for the advice on how to do commit logs, you definitely know a lot more about the topic than I do. It's nice to hear from you again, even if it is because I am doing a bad job at the commit logs. I'll try to do a better job next time. Short summary at the top that lists what was changed, got it.

With that particular bug, though, I did feel it needed a bit more explanation for why it would be necessary to mess with ClearType settings (since it's actually a bug in Windows and not Liberal Crime Squad, so the best we can do is a workaround to temporarily disable ClearType). It's definitely a bug in Windows XP, I haven't yet determined whether or not the bug still exists in Windows Vista, Windows 7, etc. Having a game tinker with one of the operating system's settings is certainly unconventional, though. That is why it has to be an option in init.txt that is off by default, because we don't want to change settings on anyone's computers without their permission. Only users who actively take the step to edit init.txt and enable this workaround will have any of their settings changed. Internet Explorer 7 and later mess with ClearType settings, but in a less ethical way, since they change the settings without the user's permission and the user isn't the one in charge. The change in settings is only temporary, as long as the program is closed properly, but unfortunately Alt-F4, pressing the X in the corner to close the Window, or the game crashing all result in the setting change being permanent.

The main reason this was a priority, though, was because users of international versions of Windows have to use a TrueType font like Lucida Console for text display in order to display the correct characters, as the Win32 API doesn't allow for Unicode or for switching character sets if you are using a raster font like Terminal, so international users would get stuck with the wrong characters otherwise. But because of the display problems with TrueType fonts when ClearType is enabled, that causes further headaches for international users. And since we have a developer working on a French translation of the game, I thought it would be best to give that developer the option of disabling ClearType to fix the remaining display issues on international versions of Windows.

Anyway, thanks for the advice, short summary of all the changes on top, try not to ramble on or have a wall of text in a changelog. Definitely good advice for me to follow next time.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL
Pages: [1] 2