[CF-Devel] artifact list error
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Thu Mar 4 22:14:15 CST 2004
I have a better solution than just increasing the buffer.
With this patch one can now have multiple "Allowed" lines.
See examples in artifact.diff.
This way we have a nicely editable file and can avoid buffer-overflow.
Bernd Edler
-------------- next part --------------
Index: treasure.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/common/treasure.c,v
retrieving revision 1.46
diff -c -r1.46 treasure.c
*** treasure.c 3 Mar 2004 01:17:09 -0000 1.46
--- treasure.c 5 Mar 2004 03:34:19 -0000
***************
*** 1182,1192 ****
cp=buf;
while(*cp==' ') /* Skip blanks */
cp++;
!
if (!strncmp(cp, "Allowed", 7)) {
! art=get_empty_artifact();
!
! nrofartifacts++;
cp = strchr(cp,' ') + 1;
if (!strcmp(cp,"all")) continue;
--- 1182,1194 ----
cp=buf;
while(*cp==' ') /* Skip blanks */
cp++;
! if (*cp=='\0') continue;
!
if (!strncmp(cp, "Allowed", 7)) {
! if (art==NULL) {
! art=get_empty_artifact();
! nrofartifacts++;
! }
cp = strchr(cp,' ') + 1;
if (!strcmp(cp,"all")) continue;
***************
*** 1219,1224 ****
--- 1221,1227 ----
}
art->next = al->items;
al->items = art;
+ art = NULL;
}
else
LOG(llevError,"Unkown input in artifact file: %s\n", buf);
-------------- next part --------------
*** artifacts~ Fri Mar 5 02:58:02 2004
--- artifacts Fri Mar 5 02:58:02 2004
***************
*** 392,398 ****
item_power 1
end
#
! Allowed axe,axe_2,axe_3,axe_4,axe_5,battle_axe,stoneaxe,poleaxe,morningstar,large_morningstar,nunchacu_1,nunchacu_2,hammer,mace,mace_2,lspear,spear,club,quarterstaff,big_club,stonehammer,stake,bonecrusher,mjoellnir,skullcleaver
chance 20
Object Gaea
type 15
--- 392,401 ----
item_power 1
end
#
! Allowed axe,axe_2,axe_3,axe_4,axe_5,battle_axe,stoneaxe,poleaxe,morningstar
! Allowed large_morningstar,nunchacu_1,nunchacu_2,hammer,mace,mace_2
! Allowed lspear,spear,club,quarterstaff,big_club,stonehammer,stake
! Allowed bonecrusher,mjoellnir,skullcleaver
chance 20
Object Gaea
type 15
***************
*** 645,651 ****
item_power 1
end
#
! Allowed axe,axe_2,axe_3,axe_4,axe_5,battle_axe,hammer,skullcleaver,mjoellnir,bonecrusher,frost_hammer
chance 10
Object Mostrai
type 15
--- 648,655 ----
item_power 1
end
#
! Allowed axe,axe_2,axe_3,axe_4,axe_5,battle_axe,hammer,skullcleaver
! Allowed mjoellnir,bonecrusher,frost_hammer
chance 10
Object Mostrai
type 15
***************
*** 685,691 ****
#
# Metal Weapons
#
! Allowed dagger,light_sword,shortsword,shortsword_2,taifu_1,trident,axe,axe_2,axe_3,axe_4,axe_5,battle_axe,poleaxe,morningstar,large_morningstar,hammer,mace,mace_2,lspear,spear,sword,sword_2,sword_3,sabre,rapier,rapier,scimitar,katana_1,falchion,broadsword,broadsword_2
chance 5
Object Sorig
type 15
--- 689,699 ----
#
# Metal Weapons
#
! Allowed dagger,light_sword,shortsword,shortsword_2,taifu_1,trident
! Allowed axe,axe_2,axe_3,axe_4,axe_5,battle_axe,poleaxe
! Allowed morningstar,large_morningstar,hammer,mace,mace_2
! Allowed lspear,spear,sword,sword_2,sword_3,sabre,rapier,rapier,scimitar
! Allowed katana_1,falchion,broadsword,broadsword_2
chance 5
Object Sorig
type 15
***************
*** 712,718 ****
item_power 2
end
#
! Allowed dagger,axe,axe_2,axe_3,axe_4,axe_5,battle_axe,sword,sword_2,sword_3,sabre,rapier,scimitar,light_sword,katana_1,falchion,broadsword,broadsword_2,shortsword,shortsword_2,morningstar,large_morningstar,hammer,mace,mace_2,lspear,spear,poleaxe,taifu_1,trident
chance 5
Object Ruggilli
type 15
--- 720,729 ----
item_power 2
end
#
! Allowed dagger,axe,axe_2,axe_3,axe_4,axe_5,battle_axe,sword,sword_2,sword_3
! Allowed sabre,rapier,scimitar,light_sword,katana_1,falchion,broadsword
! Allowed broadsword_2,shortsword,shortsword_2,morningstar,large_morningstar
! Allowed hammer,mace,mace_2,lspear,spear,poleaxe,taifu_1,trident
chance 5
Object Ruggilli
type 15
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
crossfire-devel at lists.real-time.com
https://mailman.real-time.com/mailman/listinfo/crossfire-devel
More information about the crossfire
mailing list