On Wed, Feb 20, 2002 at 03:46:49PM +0000, Bobby Solis wrote: >>From: "Bobby Solis" <bobby_solis@HOTMAIL.COM> >>> Is there a easier patch for changing GOLD into Coins (copper, silver, gold, >>> platinum) I found coins.patch on the ftp site. But too many things are >>> different between the patch and my mud. For me to understand it, it has to >>> correspond perfectly between the patch and my mud. >>Welcor wrote: >>Have you changed a single line of code ? >>Have you got another bpl than the one the patch is for ? >>If you can answer yes to either of those questions, you will never _ever_ get >>a patch which fits 'perfectly' to your code. >>[1] Changing gold into coins of different metals isn't a trivial >>task. Save it for when you're a bit more experienced. >Yes alot of the code has changed and yes I have bpl18. >I'm not the greatest code writer but I do know the basics. But thats >besides the point. All I was looking for is a patch thats a little more >up-to-date so I don't have to spend hours hand patching this one in. But >thanks for making me feel like a moron. As welcor said, you aren't going to get a patch to fit if you changed almost any code. It just don't happen. Patch does a nice job of protecting people from being lazy by saying "Oops, the file I'm patching isn't what I'm expecting, so I'm not messing up their code. I'll give them a .rej file so they can make sure things keep working." No-one's goal is to make you feel like a moron, but we're not going to code your mud for you on the list. saying "For me to understand it, it has to correspond perfectly between the patch and my mud" simply tells everyone that you {don't know how,are too lazy} to do it for yourself. I've never looked at the coin patch mentioned, so I don't know how it's doing things, but I do disagree that it's not trivial though. There's no huge need to do anything drastic to huge sections of code, since when it comes down to it it's mostly cosmetic. If you just think in terms of a base currency, say, a penny, then everything is just multiples of that. Do all the internal stuff ie if(GET_GOLD(ch) < amount) { You cheapskate } in terms of this "base". All you'll need to do is prettify the output... here's a tool to help you with it though. --- mailer code --- #define COP_ELEC 100000 /* How many coppers per electrum piece */ #define COP_PLAT 10000 /* How many coppers per platinum piece */ #define COP_GOLD 1000 /* How many coppers per gold piece */ #define COP_SILV 100 /* How many coppers per silver piece */ /* * Hold the calculated values of each type of coin. * Makes it easier to check if you have a value of 0 for any of them. */ struct coin_struct { unsigned int electrum; unsigned int platinum; unsigned int gold; unsigned int silver; unsigned int copper; }; struct coin_struct *calc_money(unsigned int amount) { struct coin_struct *coins; unsigned int tmp = amount; CREATE(coins, struct coin_struct, 1); coins->electrum = tmp / COP_ELEC; tmp -= coins->electrum * COP_ELEC; coins->platinum = tmp / COP_PLAT; tmp -= coins->platinum * COP_PLAT; coins->gold = tmp / COP_GOLD; tmp -= coins->gold * COP_GOLD; coins->silver = tmp / COP_SILV; tmp -= coins->silver * COP_SILV; coins->copper = tmp; return(coins); } --- end mailer code --- Then just change the places where you send_to_char() a coin amount to call that with, say, calc_money(GET_GOLD(ch)) and display it from the values returned. Some work will be needed in do_give and perform_give_gold() but that's fairly trivial. -me -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT