Revision Changes

Welcome in the osRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Re: Revision Changes

Postby Drakia on Mon May 19, 2008 6:39 pm

Hmm.. just thinking here, but would it be better (One less loop) if you set a variable to 0xffff, and during the loop looking for the slot with the item you're picking up, set that to the first empty slot encountered, if you don't find the item, just return that variable because it will be 0xffff if there's no empty slots, or whatever the empty slot is if there is one?
My favorite skill is scaring new users away.
If you haven't SEARCHED expect me to yell at you.
Image
Drakia
ospRose dev team
ospRose dev team
 
Posts: 1614
Joined: Tue Sep 18, 2007 6:53 am
Location: Nanaimo, BC, Canada

Re: Revision Changes

Postby PurpleYouko on Mon May 19, 2008 8:03 pm

It probably could be condensed it into a single pass through the inventory or storage.
I'm not quite sure how you could do it with setting a variable to 0xffff first though.
What we would need, I think, are two flag variables initially set to false.
Set the first to true if a usable stack is found and the second one true if an empty slot is found.
Then by the state of these two flags we can control the returned value

Then again, that would mean that the entire loop would need to be parsed each time you call the function. 160 comparisons each time.
The way I have it now, if it finds a suitable stack in the first couple of slots then it will instantly kick out and return the value.
Only if there isn't a matching stack does it do the full 160 comps and then go on to search for empty slots.

This function isn't really used often enough to be that concerned about speed though so i think either way would have its advantages and disadvantages.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Revision Changes

Postby Drakia on Mon May 19, 2008 8:30 pm

I was thinking of something to this effect
  1.    UINT emptySlot = 0xffff;
  2.     for (int i = 0; i < 30; i++) {
  3.       UINT slot = 12;
  4.       slot += (tabsize * itemtab) + i;
  5.  
  6.       if (emptySlot == 0xffff && items[slot].itemnum == 0 && items[slot].count < 1) emptySlot = slot;
  7.  
  8.       if ((itemtab == 1 || itemtab == 2)) {
  9.         if (items[slot].itemnum == thisitem.itemnum && items[slot].itemtype == thisitem.itemtype) {
  10.           int totcount = thisitem.count + items[slot].count;
  11.           if (totcount < 999)
  12.             return slot;
  13.         }
  14.       } else {
  15.         if (items[slot].itemnum == 0 && items[slot].count < 1)
  16.           return slot;
  17.       }
  18.     }
  19.     return emptySlot;


[Rev 44]
Added the code required to use 124 client.
You will need to uncomment the "#define USE124" line in rosecrypt.hpp and put trose.exe from the 124 client into your server folder to use it. This is dev only, it doesn't work properly.
Renamed "POISED" to "POISONED" in the buff files.

[Rev 45]
Mobs can now be attacked with 124 client.
My favorite skill is scaring new users away.
If you haven't SEARCHED expect me to yell at you.
Image
Drakia
ospRose dev team
ospRose dev team
 
Posts: 1614
Joined: Tue Sep 18, 2007 6:53 am
Location: Nanaimo, BC, Canada

Re: Revision Changes

Postby PurpleYouko on Tue May 20, 2008 2:07 pm

Yeah that code looks like it will work perfectly to achieve the same thing.
The important bit is to make sure it preferentially returns a slot with a stack of the same items in it rather than the first empty slot it reaches.
It looks like you captured that ok.

As for using the 124 client. What exactly are the advantages?
There is no way that I can use it the way it is now because i cannot modify my hosts file to set up a redirect to a local GG server.
At home I have no problem. It will run just fine. But i don't do any dev work while I'm there. ;)

I'm stuck with 112 here unless somebody can pull out the GG stuff from 124 trose.exe.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Revision Changes

Postby Drakia on Tue May 20, 2008 6:03 pm

Well, Rob posted what they added to 124, I just thought I'd give it a shot at getting it working. Right now the server is still set to run 112, not 124, I just added the support code for if we decide to switch to 124.
My favorite skill is scaring new users away.
If you haven't SEARCHED expect me to yell at you.
Image
Drakia
ospRose dev team
ospRose dev team
 
Posts: 1614
Joined: Tue Sep 18, 2007 6:53 am
Location: Nanaimo, BC, Canada

Re: Revision Changes

Postby rl2171 on Tue May 20, 2008 8:01 pm

Drakia wrote:Well, Rob posted what they added to 124, I just thought I'd give it a shot at getting it working. Right now the server is still set to run 112, not 124, I just added the support code for if we decide to switch to 124.


I may have an exe from kRose from the old days, it may not have the gg, but I will check when I get home.
Image
rl2171
Admin
Admin
 
Posts: 1706
Joined: Mon Aug 06, 2007 5:17 pm
Location: Sacramento, CA USA - GMT-8

Previous

Return to Support - OspRose Emulator

Who is online

Users browsing this forum: No registered users and 4 guests

cron