diff --git a/Makefile b/Makefile index c1085e5..f8bebda 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -LIBS=-lm +LIBS= all: diff --git a/character.c b/character.c index dd86b7d..a49b080 100644 --- a/character.c +++ b/character.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "chargen.h" #include "character.h" @@ -32,7 +31,7 @@ void addLanguage(long lang){ if((lang & languages ) == 0){ languages = languages + lang; }else{ - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); } } @@ -40,7 +39,7 @@ void addProf(long prof){ if((prof & profs) == 0){ profs = profs + prof; }else{ - addProf(exp2l(arc4random_uniform(18))); + addProf(1lu << arc4random_uniform(18)); } } @@ -63,7 +62,7 @@ void classProfs(unsigned long* classprofs, int count, int num){ //Grab the first N elements, based on the class's value, but first, if we have more profs than available profs, get some random ones if(num > count){ for(count;num > count;count--){ - addProf(exp2l(arc4random_uniform(18))); + addProf(1lu << arc4random_uniform(18)); } } for(int i=0;i<=num;i++){ @@ -81,9 +80,9 @@ void genClass(){ classProfs(barbskills, 6, 2); break; case BARD:; - addProf(exp2l(arc4random_uniform(18))); - addProf(exp2l(arc4random_uniform(18))); - addProf(exp2l(arc4random_uniform(18))); + addProf(1lu << arc4random_uniform(18)); + addProf(1lu << arc4random_uniform(18)); + addProf(1lu << arc4random_uniform(18)); strlcat(otherprofs, "Three Musical Instruments, ", sizeof(otherprofs)); hp = 8 + mods[CON]; break; @@ -176,7 +175,7 @@ void genRace(){ if(subrace == 0){ race = "High Elf"; stats[INT]+=1; - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); }else if(subrace == 1){ race = "Wood Elf"; stats[WIS]+=1; @@ -202,9 +201,9 @@ void genRace(){ stats[CHA]+=2; stats[arc4random_uniform(4)]+=1; stats[arc4random_uniform(4)]+=1; - addProf(exp2l(arc4random_uniform(18))); - addProf(exp2l(arc4random_uniform(18))); - addLanguage(exp2l(arc4random_uniform(15))); + addProf(1lu << arc4random_uniform(18)); + addProf(1lu << arc4random_uniform(18)); + addLanguage(1lu << arc4random_uniform(15)); addLanguage(ELVISH); break; case HALFLING: @@ -232,7 +231,7 @@ void genRace(){ stats[INT]+=1; stats[WIS]+=1; stats[CHA]+=1; - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); break; case TIEFLING: stats[INT]+=1; @@ -252,8 +251,8 @@ void genBackground(){ case ACOLYTE: addProf(INSIGHT); addProf(RELIGION); - addLanguage(exp2l(arc4random_uniform(15))); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); + addLanguage(1lu << arc4random_uniform(15)); break; case CHARLATAN: addProf(DECEPTION); @@ -282,32 +281,32 @@ void genBackground(){ case GUILDARTISAN: addProf(INSIGHT); addProf(PERSUASION); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); strlcat(otherprofs, "Artisan's Tools, ", sizeof(otherprofs)); break; case HERMIT: addProf(MEDICINE); addProf(RELIGION); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); strlcat(otherprofs, "Herbalism Kit, ", sizeof(otherprofs)); break; case NOBLE: addProf(HISTORY); addProf(PERSUASION); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); strlcat(otherprofs, "Gaming Set, ", sizeof(otherprofs)); break; case OUTLANDER: addProf(ATHLETICS); addProf(SURVIVAL); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); strlcat(otherprofs, "Musical Instrument, ", sizeof(otherprofs)); break; case SAGE: addProf(ARCANA); addProf(HISTORY); - addLanguage(exp2l(arc4random_uniform(15))); - addLanguage(exp2l(arc4random_uniform(15))); + addLanguage(1lu << arc4random_uniform(15)); + addLanguage(1lu << arc4random_uniform(15)); break; case SAILOR: addProf(ATHLETICS); @@ -345,7 +344,7 @@ size_t genChar(char* output, size_t maxlen){ genBackground(); for(i=0; i < 6; i++){ stats[i] = dieroll(3,6); - mods[i] = floor((stats[i]/2)-5); + mods[i] = (stats[i]/2)-5; } snprintf(output, maxlen, "Race = %s\r\nBackground = %s\r\nClass = %s\r\nStr = %d %d\r\nDex = %d %d\r\nCon = %d %d\r\nInt = %d %d\r\nWis = %d %d\r\nCha = %d %d\r\n\r\nHP: %d\r\n", race, background, class, stats[STR], mods[STR], stats[DEX], mods[DEX], stats[CON], mods[CON], stats[INT], mods[INT], stats[WIS], mods[WIS], stats[CHA], mods[CHA], hp);