Skip to content

Feature Request: Pad left "plugin id" with "zeros" based on the plugin count. #994

@Mart-User

Description

@Mart-User

Feature Request: Pad left "plugin id" with "zeros" based on the plugin count.

Need a modification on file: PluginSys.cpp (Lines 1726 / 1733, or just search for %02d)

This is not an issue, just a better way to see the "Plugin Id" number installed through console "sm plugins list"

As an example, I have more than 100+ plugins installed, and when I type "sm plugins list" on the console, plugin list starts like this:

01 - Plugin 1
02 - Plugin 2
...
98 - Plugin 99
99 - Plugin 99
... here 
100 - Plugin 100

After 99, is added an extra space to the plugin name, since the default plugin id padding is based on a length of 2

I made a working code snippet in pawn that would make the zeros displays based on the plugin count

smpluginscount.txt

So the code on PluginSys.cpp (Line 1733) would become:
From:
len += ke::SafeSprintf(buffer, sizeof(buffer), " %02d", id);
To:
len += ke::SafeSprintf(buffer, sizeof(buffer), " %s", sPluginId);

I fixed the length in 10 since int max value is 2147483647 (len of 10).
This code has not the best performance, since I don't know how to port this on Pawn.
in C# would be simple to do that:
Console.WriteLine("{0}", id.ToString().PadLeft(GetPluginCount.ToString().Length, '0'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions