Bay 12 Games Forum

Please login or register.

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

Author Topic: Some questions about the code  (Read 3898 times)

Codaxio

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #15 on: August 22, 2013, 02:26:05 am »

I'm running on Windows 7 and so yes the ClearType font gives you these blue lines, about Vista there is probably the same problem and Windows 8... is a total mystery for me, I tried once in a store I didn't understand nothing with this metro UI !
I've just tested on Ubuntu 13.04, no problem on this O.S, even the accents can be displayed easily but with the normal way not the backslash way. About Mac, someone has one in my family but I don't know how to compile and run programs on this O.S, but I heard that Ubuntu and MacOS had both the same kernel, perhaps the console display is the same.

You should include these changes in your French version of the game! Then everything will look much better on the screen.

And of course I'm gonna use your last revision ! Even if this imply for me to do a lot of copy-paste of all the strings translated. Fortunatly I only finished the basemode folder and a part of the file chase.cpp, so I hope this won't be too long !
Logged

Codaxio

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #16 on: August 24, 2013, 08:35:07 am »

Hello,

For the moment I have stopped the translation because you seem to solve a lot of bugs Liberal Elitist so maybe I'm gonna wait a week or two until some new revisions come up otherwise I will have to much copy-paste to do.
Meanwhile I try to find solution to this masculine/feminine problem, and this time it's when a character has no armor he is "naked" and the french translation is  "nu" or "nue" depending if the person is a man or a woman.
So I changed some parts of the code but it doesn't work (not very well at least), I don't manage to determine the gender of the liberal, I have errors that I don't understand.

First I added a new type of armor for woman in the file "armor.xml"

Code: [Select]
        <armortype idname="ARMOR_NONE_F">
        <body_covering>
            <head>false</head>
            <body>false</body>
            <arms>false</arms>
            <legs>false</legs>
        </body_covering>
        <can_get_bloody>false</can_get_bloody>
        <can_get_damaged>false</can_get_damaged>
        <name>Nue</name>
        <shortname>Nue</shortname>
        <professionalism>0</professionalism>
        <conceal_weapon_size>0</conceal_weapon_size>
    </armortype>
   
Then in "creature.cpp" (line ~1580) there is the interesting function which handles with this "armor_none", here are my modifications :

Code: [Select]
Armor& Creature::armor_none()
{
static Armor* naked;

if(gender_liberal == GENDER_MALE)
{
    naked = new Armor(*armortype[getarmortype("ARMOR_NONE")]);
}
else if (gender_liberal == GENDER_FEMALE)
{
    naked = new Armor(*armortype[getarmortype("ARMOR_NONE_F")]);
}

return *naked;
}

But this code gives me this error : \src\creature\creature.h|299|error: invalid use of member 'Creature::gender_liberal' in static member function

So I decided to use the function "heshe()" ("creature.cpp" line 1561) :

Code: [Select]
const char *Creature::heshe()
{
if(gender_liberal == GENDER_MALE)
{
return "he";
}
if(gender_liberal == GENDER_FEMALE)
{
return "she";
}
return "they";
}

Armor& Creature::armor_none()
{
char *masculinFeminin = this->heshe();

static Armor* naked;

if(masculinFeminin == "he")
{
    naked = new Armor(*armortype[getarmortype("ARMOR_NONE")]);
}
else if (masculinFeminin == "she")
{
    naked = new Armor(*armortype[getarmortype("ARMOR_NONE_F")]);
}

return *naked;
}

I thought that "this" was the right thing to use because both of these functions belong to the same class "Creature" but this time the error is : \src\creature\creature.cpp|1582|error: 'this' is unavailable for static member functions
I don't know how to correct these errors. My knowledges in C++ are more oriented in mathematics or in physics, I've never made changes (until now) in a so big project like LCS (it's funny because I read somewhere in your posts Liberal Elitist that for you it's a small project (in term of files), everything is relative !).
At least the rest of the code works because I replaced this line "char *masculinFeminin = this->heshe();" by this "char *masculinFeminin = "she";" and "Nue" was displayed, it's just a matter of getting the gender.

If someone know the solution please tell me. Thanks. I guess this time it's probably easier to solve than the accents problem.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Some questions about the code
« Reply #17 on: August 24, 2013, 04:15:37 pm »

Codaxio:

Try changing the line in creature.h that says "static Armor& armor_none();" to "Armor& armor_none() const;" (get rid of "static" at the beginning and add "const" at the end). I believe it's on line 281 on creature.h. Or download the latest revision, revision 721, which already has this change, among other things.

If you ever get an error message like "invalid use of member ... in static member function" or " 'this' is unavailable for static member functions", you need to make sure the function doesn't have the word "static" describing it in the header (.h) file where the function is declared.

Any function that is "static" is not allowed access to the "this" object or to any variables that are part of the class. A function that is "const" DOES have access to "this" and to variables that are part of the class, but it is not allowed to change any of those variables. So changing it from "static" to "const" in the creature.h header file will get rid of the compiler errors, without changing things TOO much.

As for the code for armor_none(), both functions you wrote would work fine except you forgot 1 thing: there are 4 genders in the game: GENDER_NEUTRAL, GENDER_FEMALE, GENDER_MALE, and GENDER_WHITEMALEPATRIARCH. And another thing is, the function is no longer static but const instead. Plus the code is rather long. So to account for all 4 gender possibilities, have the function not be static, and have the code be short and succinct I would suggest using this code if you want to keep things simple:

Code: [Select]
Armor& Creature::armor_none() const
{
   static Armor* naked = new Armor(*armortype[getarmortype(gender()==GENDER_FEMALE?"ARMOR_NONE_F":"ARMOR_NONE")]);
   return *naked;
}

I am treating intersex/transgender people as male for purposes of this function because from what I have looked up about the French language, everything in French is either male or female, there is no neutral gender of "it", and male is the default for a majority of nouns. So a naked transsexual would be "nu" instead of "nue", I think, so the above code should be correct. If you want to be Conservative, that is.

If you would like to have more Liberal language and treat "she" as the default gender for transsexuals and intersex persons in keeping with the feminist movement, I suggest you use this FEMINIST-APPROVED ELITE LIBERAL code for your function:

Code: [Select]
Armor& Creature::armor_none() const
{
   static Armor* naked = new Armor(*armortype[getarmortype(gender()l==GENDER_FEMALE||gender()==GENDER_NEUTRAL?"ARMOR_NONE_F":"ARMOR_NONE")]);
   return *naked;
}

Yes, that is the code you should use. The earlier code I had higher up, using male as the default gender, is far too Conservative, patriarchal, and oppressive to women, and goes against everything feminists and other Liberals believe in.

Oh, and another thing. I've updated the code. Revision 721 no longer requires you to modify creature.h, as I've done it for you, as well as making changes to weapon_none() and armor_none() to switch them from static to const functions (so now you only need to change 1 line of code in armor_none()). Also the function heshe() is a lot more complicated now, and there is a new function, gender(), which you should use instead of gender_liberal or gender_conservative to get a Creature's gender for most purposes in the game, and I have put it to use in the above code. gender() returns gender_liberal unless Gay Rights laws are C+, in which case it returns gender_conservative, and it also checks to see if the return result is going to be GENDER_WHITEMALEPATRIARCH, and returns GENDER_MALE instead if that is the case. That simplifies things from 4 cases to 3 cases if you use gender().
« Last Edit: August 24, 2013, 09:35:21 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

Codaxio

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #18 on: August 25, 2013, 03:15:47 am »

Thanks, but in France we always use “he” as the default gender because it's an old rule that we learn as soon as possible when we study french language. Use “she” will be to weird and will be confusing for most of the people, we will consider it as an grammatical mistake.
I haven't test your code yet but it should probably work fine, and I will see in the same time your changes on the function heshe().
Logged

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #19 on: August 25, 2013, 04:44:09 am »

For the moment I have stopped the translation because you seem to solve a lot of bugs Liberal Elitist so maybe I'm gonna wait a week or two until some new revisions come up otherwise I will have to much copy-paste to do.
If you use SVN it can automatically merge changes in the repository with your own changes as long as they don't conflict.

Also, GENDER_WHITEMALEPATRIARCH is only used for generating names. No creature has it as their gender.
Logged

Codaxio

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #20 on: August 25, 2013, 04:59:00 am »

If you use SVN it can automatically merge changes in the repository with your own changes as long as they don't conflict.

What changes are considered as conflict ? Because all the strings will be differents plus sometime I need to add some conditions like the ones before this answer or change some coordonates in the function move(x,y), even add new type or armor and soon new professions always because of the gender. I'm afraid that SVN will erase all the changes I made.

Edit :

Thanks for the tip Carlos Gustavos, after some tests I think that the file is erased by the new one only if there are modifications where the new revisions made some changes. And I tested your code Liberal Elitist and it works but not very well, it's depending of the gender of the leader. If it's a male "Nu" will be displayed even if there are women in the squad and the same for the other gender.
The only code which works is the one with this->hisher(). I declared the variable masculinFeminin const char* instead of char* and everything is ok. Maybe now I need to add another else or else if to deal with the last gender, or simply like this if(masculinFeminin == "his" || masculinFeminin == "its || masculinFeminin == "xyr"). But xyr really exists in english language ?
« Last Edit: August 25, 2013, 07:43:03 am by Codaxio »
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Some questions about the code
« Reply #21 on: August 25, 2013, 10:24:10 am »

Also, GENDER_WHITEMALEPATRIARCH is only used for generating names. No creature has it as their gender.

Noted. I will remove the checks for GENDER_WHITEMALEPATRIARCH that I added.

And I tested your code Liberal Elitist and it works but not very well, it's depending of the gender of the leader. If it's a male "Nu" will be displayed even if there are women in the squad and the same for the other gender.
The only code which works is the one with this->hisher(). I declared the variable masculinFeminin const char* instead of char* and everything is ok. Maybe now I need to add another else or else if to deal with the last gender, or simply like this if(masculinFeminin == "his" || masculinFeminin == "its || masculinFeminin == "xyr"). But xyr really exists in english language ?

Sorry about it not working very well. Also I am getting rid of the gender() function and we'll go back to using gender_liberal to get people's gender from now on, because of some advice from Jonathan S. Fox to have the game view things from an Elite Liberal perspective. "Xe"/"xem"/"xyr" isn't standard in English but it is used by some people who wish to have gender-neutral pronouns and don't believe in binary gender identities. Since this game is a parody and views things from an Elite Liberal perspective, "xe"/"xem"/"xyr" make sense for this game to use even though they aren't standard English. Look at http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/sex-neutral-pronouns.html for more information on those gender-neutral pronouns (which are generally considered neologisms, i.e. newly coined words that aren't widely used, by most people, and would not be found in any standard dictionary).
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

KA101

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #22 on: August 25, 2013, 09:14:10 pm »

Thanks, but in France we always use “he” as the default gender because it's an old rule that we learn as soon as possible when we study french language. Use “she” will be to weird and will be confusing for most of the people, we will consider it as an grammatical mistake.
I haven't test your code yet but it should probably work fine, and I will see in the same time your changes on the function heshe().

Quote
because it's an old rule that we learn as soon as possible

That sounds Arch-Conservative to me...
Logged

Mazur

  • Bay Watcher
  • Mad as a March Hatter.
    • View Profile
Re: Some questions about the code
« Reply #23 on: August 25, 2013, 10:38:14 pm »

Thanks, but in France we always use “he” as the default gender because it's an old rule that we learn as soon as possible when we study french language. Use “she” will be to weird and will be confusing for most of the people, we will consider it as an grammatical mistake.
I haven't test your code yet but it should probably work fine, and I will see in the same time your changes on the function heshe().

Quote
because it's an old rule that we learn as soon as possible

That sounds Arch-Conservative to me...

To you, perhaps, but in French, "he" is equal with "it"¸ and therefore already perceived as fairly gender-neutral.
Logged

Codaxio

  • Bay Watcher
    • View Profile
Re: Some questions about the code
« Reply #24 on: August 26, 2013, 04:45:42 am »

Ok, I didn't want to do it in this thread but I will give you explanations about the French grammar.

The first thing that you must understand is that every nouns and adjectives must be either masculine or feminine, there is no neutral type in your language (in the rest of the answer I will use the letter 'M' for masculine and 'F' for feminine).
So the 'a' or 'an' can have two possible translations in french : 'a' can be 'un' (M) or 'une' (F) and 'an' doesn't exist, you can always put 'une' or 'un' before a noun.
Examples :
- a lion = un lion (M)
- a giraffe = une girafe (F)
- an animal = un animal (M)
- an apple = une pomme (F)

Then there is 'the' which has three possible translations 'le' (M) 'la' (F) and 'l' ' which is a kind of equivalent for 'an'.
Examples :
- The lion = Le lion
- The giraffe = La girafe
- The animal = L'animal

Then come 'he' = 'il', 'she' = 'elle' and 'it' has no translation because we use 'he' or 'she' for everything even animals or objects. So we don't need the 'it'.
Examples :
- The lion, it is the king of the jungle. = Le lion, il est le roi de la jungle.
- The giraffe, it has a very long neck. = La girafe, elle a un cou très long.
- The telephone, it is ringing. = Le téléphone, il sonne. (M)
- The room, it is beautiful. = La pièce, elle est belle. (F)

And finally the last thing is 'they' which have two translations, 'ils' (M) and 'elles' (F) and this is only in this case that the we apply the rule that KA101 found a bit arch-conservative. You will understand quickly with an example that there is a problem because of our two possible translations.

Examples :
- Lions, they live in the savanna. = Les lions, ils vivent dans la savane. (M)
- Giraffes, they live in the savanna. = Les giraffes, elles vivent dans la savane. (F)

Now maybe you will see the next problem, when you have these animals in the same sentence, in english there is no problem you always use 'they', but in french what do we do ? Shall we use 'ils' because of lions (M) or 'elles' because of giraffes (F) or something else but there is not a such word.

Lions and giraffes, they both live in the savanna. = Les lions et les girafes, ils/elles(?) vivent tous les deux dans la savane. (wrong)

Here is the problem. You have to choose 'ils' or 'elles' you can't put them together like I did else the sentence is non sense. So that's why we learn this rule asap, and this last tells us that when we encounter this kind of case where you have both M and F nouns you must use 'ils' (M).
So the example become :

Lions and giraffes, they both live in the savanna. = Les lions et les girafes, ils vivent tous les deux dans la savane. (correct)

Don't ask me why, it's an old rule instated by Richelieu under the king Louis XIII during the XVII century, I supposed he had to make a choice and he chose 'ils' instead of 'elles'.
So my explanations were a bit false in this answer :

Thanks, but in France we always use “he” as the default gender because it's an old rule that we learn as soon as possible when we study french language. Use “she” will be to weird and will be confusing for most of the people, we will consider it as an grammatical mistake.

Because as you see it's not really concern 'he' but more 'they' and only in certains cases. But in order to expose you the problem, I had to explain a lot of things before otherwise it's a bit hard to understand without.

And to finish, as far as I know there is only ONE word in french which we can be consider as “neutral” and it's 'an afternoon' because you can both say 'un après-midi' (M) or 'une après-midi' (F). But as you see there is no other word than 'une' or 'un', people have to choose between the one they prefer and it's not consider as a grammatical fault.
« Last Edit: August 26, 2013, 04:51:14 am by Codaxio »
Logged

Mazur

  • Bay Watcher
  • Mad as a March Hatter.
    • View Profile
Re: Some questions about the code
« Reply #25 on: August 26, 2013, 11:05:49 am »

I sit¹ corrected.

And I was lied to in French in highschool, where I was taught that neutral words (in my native Dutch, which has male,  female and neuter as word genders) always got the male pronoun in French.  But as you´ve just expostulated, that is not completely right.

¹ As I'm nor standing (lame joke).
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Some questions about the code
« Reply #26 on: August 26, 2013, 11:54:06 pm »

Yes, I knew that French only had the 2 genders and that every noun is either masculine or feminine, and adjectives and articles modifying a noun must match it in gender. The same thing is true in Spanish, which I have studied. I have also studied Latin, which has 3 genders, as well as a bit of German and Hungarian, neither of which I understand the grammar of very well. I THINK German has 3 genders commonly used for nouns, just like Latin, but I'm not entirely sure. If I recall correctly, the German articles "Das", "Die", and "Der" are for 3 different genders, but I don't remember which is which. But as a native English speaker, foreign languages all confuse me, even the ones I've studied or know a bit of, since I'm just not that good at any of them. I think I've actually even started to pick up on a little Japanese because of watching lots of anime cartoons, although only a VERY small amount, less than 10 words, even smaller than my Hungarian vocabulary of around 20 words. That's why I stick to English, it's the only language I'm any good at. But since my sister lives in Vienna, Austria, I have to know some German for whenever I visit Austria, just to get around. I know a little bit of Hungarian just because I'm half-Hungarian myself and my mom and her family immigrated from Hungary, and whenever my mom got together with my uncles and my grandparents back when I was a kid, they'd all talk Hungarian. As for Latin, I studied it way back in high school, and although I was pretty good at it and knew it pretty well at the time, I've forgotten it almost completely. As for Spanish, I studied it in college, I went overseas to Mexico for a month for language immersion study in Spanish, and for a short time I was actually close to fluent in Spanish, but my skills in Spanish have declined since then and are now back to a low-intermediate level, about the same as my German is currently. My Latin and Hungarian are both VERY low currently, almost nothing now, almost as low as the tiny, minute small amount of Japanese that I know from watching anime. I've never studied or used French, but like most Romance languages, it makes a certain amount of sense to me and I can guess at the meanings of about half the words if I see them written down, just like with Italian.
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

Mazur

  • Bay Watcher
  • Mad as a March Hatter.
    • View Profile
Re: Some questions about the code
« Reply #27 on: August 28, 2013, 10:54:41 am »

As I am Dutch, and we historically made a living in trade, understanding foreign languages (and cultures) was always lucrative, and consequentially the languages of our neighbors are mandatory up to a point in highschool.  So I know enough French and German to get by day to day if dropped without preparation in the middle of it.  I had a special affection for English, so I elected that one to graduate in. I also enjoyed two years of Latin and 6 years of classical Greek back then, but my knowledge of those two has sunk to a level of recognizing commonly used wordparts in Greco-Latin fancy words.

Dutch, a germanic language closely related to Low-German, also has three genders, masculin, feminine and neuter.  In German the prepositions for those are, respectively: Der, Die, Das.
Logged
Pages: 1 [2]